So, fancy new Firefox 3 uses a sweet new database to manage all your history & bookmarks. Which can make for awesomely fast bookmarks and awesome bar usage for the first little while. The only problem is that the database in use is Sqlite3, which has one minor problem for Firefox 3 users: it becomes clogged with dust.
Well it isn’t actually dust, but stale indexes, and the like. The solution is to Vacuum the database.
On Ubuntu you’ll have to navigate to your Firefox profile folder in a terminal. So launch a terminal.
cd .mozilla/firefox/
ls
Now look for a folder called “(randomcharacters).default”
For example it could be called “1g8uequb.default”
cd (folder name above)
Now copy the line below to a text file because you’ll have to shut down Firefox to complete the next step.
Shut down firefox and run the following command.
for i in *.sqlite; do echo "VACUUM;" | sqlite3 $i ; done
It won’t output anything if it runs correctly and should take a minute or two before it returns you to the terminal. If you get a “SQL error near line 1: database is locked” then Firefox is still running. Wait a second and try the command above again.
Launch Firefox up again and appreciate the new found snappiness.
Taken from: http://www.gettingclever.com/2008/06/vacuum-your-firefox-3.html