What's the effective way to compact sqlite3 db?
sqlite
Solution
From SQLite: https://www.tutorialspoint.com/sqlite/sqlite_vacuum.htm
You can compact table:
sqlite> VACUUM table_name;
Compact the whole database:
sqlite> VACUUM;
Set to compact automatically the full database, it shrinks when you have delete/update records:
sqlite> PRAGMA auto_vacuum = FULL;
Set to auto compact database, but must be manually activated:
sqlite> PRAGMA auto_vacuum = INCREMENTAL;
Problem
After a few delete and insert, our sqlite3 was inflated from 300K to over 4MB. In Firefox sqlite3 manager, we open the db and compact it. There is no size change. Then we move the db file to a server which responses to sqlite3 command. We did (following post (by Lars Windolf) on VACUUM): ``` $sqlite3 /path/to/db/mydb.sqlite3 "VACUUM;" ``` However there is no size reduction at all. We are running out of ideas. What's the effective way doing compact of sqlite3?