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?
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;
I had success compacting my SQLite DB with VACUUM
.
sqlite3 /path/to/db/mydb.sqlite3 'VACUUM'
Updated: Before this anwer said VACUUM table_name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With