Is it not normally bad practice to have 2 tables with basically identical fields and move rows between them?
Isn't that exactly what indexes were designed for?
Isn't that exactly what indexes were designed for?
I'm not as familiar with sqlite, but it might have a similar problem in this case since the primary clustered index is on rowid and not a value that correlates with whether the queue item is running.
Indexes are just the tip of the iceberg (but sometimes just using partial indexes may do wonders), it’s ability to tweak stuff like fillfactor for a frequently updated small portion of the table (e.g. active sessions vs archived sessions) is that makes a lot of difference.