SQLite Forum

Defragment a table ?
A without rowid table isn't going to help things if the primary key is already an integer. In those cases I think it's even less efficient since there are a number of optimizations for rowid tables.

Autovacuum can actually increase fragmentation. It doesn't do any re-ordering, all it does it try to shrink the file by moving used pages from the end of the file to free pages towards the front, then truncating the file.

You could put A and B into separate database files and ATTACH them when they're both needed. Then A would be in its own file which can be vacuumed on its own. Though that would of course require there to not be any foreign keys, triggers, etc between the two tables.