Skip to main content

Compacting a SQLite3 DB file

·88 words·1 min· ·
General
Ariejan de Vroom
Author
Ariejan de Vroom
Jack of all Trades, Professional Software Craftsman

If you have a lot of mutations in your SQLite3 database the file size of the db file will increase a lot over time.

This can be annoying, so you’ll need to clean up old indices and other cruft that’s making your db heavy.

The solution is über-easy:

$ sqlite3 mystuff.db
SQLite version 3.6.6.2
sqlite> VACUUM;
sqlite> .quit

Note that you need to use capitals here. This will clean your db file and reduce its file size dramatically (depending on the amount of cruft you have, of course).

Related

How to create a DSA OpenSSL certificate
·76 words·1 min
General Openssl Dsa Key Public
MacBook Pro: Black Screen of Death (or is it just faking?)
·402 words·2 mins
General Apple Mac Mbp Macbook Pro Death Black
May 14th: RubyFest!
·95 words·1 min
General Rubyfest