Home > tips > Vacuuming Firefox 3 SQLite databases

Vacuuming Firefox 3 SQLite databases

November 16th, 2008

Firefox 3 uses SQLite for history, places and various other things. These databases occasionally need VACUUMing. Quoting SQLite manual:

When an object (table, index, or trigger) is dropped from the database, it leaves behind empty space. This makes the database file larger than it needs to be, but can speed up inserts. In time inserts and deletes can leave the database file structure fragmented, which slows down disk access to the database contents.

NOTE: You need to shut down Firefox to run VACUUM.

The following commands can be used to VACUUM all FF3 sqlite databases:

$ cd ~/.mozilla/firefox/$profile/
$ tar -cf backup.tar *.sqlite # take a backup if paranoid
$ for i in *.sqlite; do sqlite3 $i vacuum; done

The difference can be quite large. For example, urlclassifier3.sqlite before and after for me:

-rw-r--r-- 1 user user 55226368 2008-11-16 13:31 urlclassifier3.sqlite
-rw-r--r-- 1 user user 29134848 2008-11-16 13:35 urlclassifier3.sqlite

So that file shrunk to about 52%. Happy vacuuming! :-P

tips

  1. No comments yet.
  1. No trackbacks yet.