Ubuntu / Linux news and application reviews.

Since version 3.0, Firefox changed the way it saves your bookmarks, history, cookies, passwords and so on - it now uses SQLite databases. This has some advantages but also disadvantages because over time, the databases are growing in size and become fragmented and this affects the time Firefox needs to start. But the SQLite databases can be optimized which improves the Firefox startup time and from my experience, also improves the awasomebar performance which becomes much more responsive and faster!

How to optimize the SQLite databases in Firefox


-For Linux:

Before we get started, make sure you have sqlite3 installed. For Ubuntu:
sudo apt-get install sqlite3

Close Firefox and run the following command in a terminal:

-For Firefox 3.0.*:
for f in ~/.mozilla/firefox/*/*.sqlite; do sqlite3 $f 'VACUUM;'; done

-For Firefox 3.5.*:
for f in ~/.mozilla/firefox-3.5/*/*.sqlite; do sqlite3 $f 'VACUUM;'; done

I suggest you make it a script and then put it in startup so that it will optimize your SQLite databases on each computer startup. To do this, create a new file in your home folder, let's call it: speed_ff.sh, and paste this in the file:

-For Firefox 3.0.*:
#!/bin/sh
for f in ~/.mozilla/firefox/*/*.sqlite; do sqlite3 $f 'VACUUM;'; done

-For Firefox 3.5.*:
#!/bin/sh
for f in ~/.mozilla/firefox-3.5/*/*.sqlite; do sqlite3 $f 'VACUUM;'; done

Then me have to make it executable. To do this, use the terminal to navigate to the folder where you created the speed_ff.sh file and:
chmod +x speed_ff.sh

Now, to run the script on every startup, go to System > Preferences > Startup Applications, click "Add", in the NAME field enter whatever you want and in the COMMAND field enter the full path to the newly created speed_ff.sh file.

-For Windows

Download IniFox which containts 2 files and extact the archive in the Firefox profile folder. The Firefox profile folder is in the following location:
  • Windows XP: C:\Documents and Settings\[username]\Application Data\Mozilla\Firefox\Profiles\[randomcharacters.default]
  • Windows Vista: C:\Users\[username]\AppData\Roaming\Mozilla\Firefox\Profiles\[randomcharacters.default]
  • Windows 7: C:\Users\[username]\AppData\Roaming\Mozilla\Firefox\Profiles\[randomcharacters.default]
Then you must close Firefox and run the IniFox.bat file. When you start Firefox again you can see that the browser starts quicker. You can also check the .sqlite file size before and after running IniFox, and you will see a noticeable difference.

Windows users - you may also want to check out this post about speeding Firefox 3.5 startup too.

Credits for IniFox: infospyware

-For Mac OSX:

Close Firefox and run the following command:
cd ~/Library/Application\ Support/Firefox/Profiles/
for f in */*.sqlite; do sqlite3 $f 'VACUUM;'; done