SQLite Forum

Defragment a table ?
Login
I'd try to turn table "A" into a without-rowid table.

That way it's always *index-organized*, i.e. equivalent to a covering index.  
You'll get slower inserts and updates (since needs to re-balance the B-Tree)  
but then all table access are equivalent to a covering index, and might be a  
*bit slower* than the best-case access of a rowid table, but (much?) faster  
than the *fragmented* worse-case access. A kind of middle road.

All the above is pure conjecture, but worth a try IMHO.  
Please report back your findings either positive or negative.

PS: vacuum is whole or nothing. Or try incremental auto vacuuming instead?