Fix

Make Firefox Faster By Vacuuming Your Database

Firefox tip: Firefox 3.0’s Awesome Bar added all kinds of features to the ‘fox, but unfortunately it’s also created some performance issues—for example, by upping the default history time, leading to larger, fragmented databases. This quick hack speeds things up.

All-things-Firefox weblog Mozilla Links previously detailed how to defragment SQLite databases with a vacuum command, but the whole process was a bit clumsy, and it required a restart. Now they’ve updated the technique with a simple bit of code you can run inside Firefox’s Error Console that requires no restart.

  • Open the Error Console: Tools menu/Error Console
  • In the Code text box paste this (it’s a single line without spaces, not three lines as shown below):
    Components.classes["@mozilla.org/browser/nav-history-service;1"].
    getService(Components.interfaces.nsPIPlacesDatabase).
    DBConnection.executeSimpleSQL("VACUUM");
  • Press Evaluate. All the UI will freeze for a few seconds while databases are VACUUMed

Once the process is complete, you should notice a big improvement in performance, especially when using the Awesome Bar to search for a web site. While you’re tweaking away, you may also want to take a look at how you can speed up Firefox by limiting your history size.

Vacuum Firefox databases for better performance, now with no restart [Mozilla Links]

Comments (AU Comments | US Comments)

  • James

    I’ve just tried this and got an ‘Illegal character’ error message in the error list. Any ideas?

    I’m running Firefox 3.5.2

  • ads

    those inverted commas with VACUUM need correction – the console doesn’t recognise them.

  • Had to change the ”VACUUM” to “VACUUM” due to illegal character warnings (different quotation marks).

  • Edward Chan

    Note that the double quote marks around “VACUUM” are the wrong double quotes. They need to be replaced with normal double quotes “, not slanted quotes ”

  • Jason Fraser

    The “curly” quotes around the VACUUM in the command above should be changed to “normal” quotes, otherwise the command won’t work (you’ll get an “illegal character” error message in the error console.)

  • Just FYI – after copying and pasting the URL you’ll need to change
    ”VACUUM”
    to
    “VACUUM”

  • Chris

    Errored out for me until I removed the space and hash at the start and replaced the quotes around VACUUM with standard quote marks…….even then I am not sure it did anything since I didn’t get any messages after hitting evalutate.

Post Your Comments

Got something to say? There are two ways to comment:

1. Guests

Click here to comment instantly.

2. Facebook Users

Click below to comment using your Facebook account.

We're looking for comments that are interesting, substantial or highly amusing. If your comments are excessively self-promotional, obnoxious, or even worse, boring, you will be banned from commenting. All comments are moderated.