gunnar wrote:
> (select uuid from session where date = (select max(date) from session))

This can be optimized to
  (select uuid from session order by date desc limit 1)
but the speed of this subquery does not matter.

> (SELECT max(cb_seq_num) FROM ordercallback WHERE 
> server_order_id=cb.server_order_id AND  sessionuuid=cb.sessionuuid AND 
> working=1)
> 3|0|0|SEARCH TABLE ordercallback USING INDEX ordercallback_index3 
> (server_order_id=? AND sessionuuid=? AND working=?)

You could try to speed this up with a covering index by adding the
cb_seq_num column to the index.


But in any case, as others have already said, it is not possible for
a write transaction to lock out a read transaction _in the middle_.

Are you using WAL? Some network file system? Virtualization?

If neither the CPU nor the disk are busy, but SQLite is not sleeping,
then what is it waiting for?  This sounds like a defective disk sector.

Try running "PRAGMA integrity_check" on (a copy of) the DB.
Try VACUUM.


Regards,
Clemens

Reply via email to