Performance tip van de dag
Als jouw Firefox, net als de mijne, grote hoeveelheden I/O doet bij het sluiten en traag is bij het gebruiken van de awesomebar, probeer dan het volgende (eerst Firefox volledig sluiten):
for f in ~/.mozilla/firefox/*/*.sqlite; do sqlite3 $f 'VACUUM;'; done
Het is onschadelijk, er zal geen data verloren gaan: het compacteert je SQLite databases. Merkbare verschillen hier.
Reactie van Qball
Perfect! een wereld van verschil.
Reactie van Chris
Big thanks. Seems to work.
Just noticed: I set history to 10 days about a month ago because awsomebar was soooo slow but it still keeps all my history in the database.
Reactie van Aquarion
For OS X, this is:
for f in ~/Library/Application Support/Firefox/Profiles/*/*.sqlite; do sqlite3 "$f" 'VACUUM;'; done
Reactie van Dav Glass
You can do this on OSX:
cd ~/Library/Application Support/Firefox/Profiles/
for f in */*.sqlite; do sqlite3 $f 'VACUUM;'; done
Reactie van Stoffe
Maybe a bug should be filed to ask Mozilla to set the database(s) to auto-vacuum, or maybe this should be done on shutdown at least.
Reactie van Ulisse
Thanks a lot, my awesomebar is really quickier now!
Reactie van michele
Yeah! tip of the year!!! :-)
Finally Firefox starts and stops in reasonable times!
Thanks a lot!
Reactie van Stefano
It is also useful for liferea, for sqlite files in ~/.liferea-1.4/mozilla/liferea/ . Thanks!
Reactie van Ian McKellar
This is the problem with using SQLite in desktop apps - I need to be my own frickin' DBA!
Reactie van Paul
Finally - I have a responsive Firefox again. Thanks!
Reactie van usar
didn't work for me on Ubuntu 8.10. I get a string of:
Unable to open database "~/.mozilla/firefox/432n677u.default": unable to open database file. Same thing when I sudo su to log in as root and run it.
Reactie van RubenV
@usar: Double check that you used the right command, looks like there's a piece of the matching pattern missing.
Reactie van Aaron Strontsman
Awesomestest! Thank you.
Reactie van mike
SQL error: constraint failed
Reactie van Richard Rebel
A general purpose shell gotcha safe version that will do all your sqlite files:
find ~ -name '*.sqlite' -exec sqlite3 '{}' 'VACUUM;' ;
Works on directories containing spaces and is safe fro cronjob use.
Reactie van rys
What about windows? How do we get a command line for Mysql lite??
Reactie van Artem Vakhitov
How do I do that on Windows? I too want my Firefox not freeze when using the not-so-awesomebar.
Reactie van RubenV
@rys, @Artem: Unfortunately, I don't have a windows computer (I'm a pure Linux user), so I can't help you out there. If someone does know how to do it: let us know!
Reactie van Kimble
Nice! This helped a lot!
Thanks
Reactie van Tom
@Aquarion,Dav Glass: Thnx! Unfortunately you forgot escaping the spaces, so the working commands are:
for f in ~/Library/Application Support/Firefox/Profiles/*/*.sqlite; do sqlite3 "$f" 'VACUUM;'; done
and
cd ~/Library/Application Support/Firefox/Profiles/
for f in */*.sqlite; do sqlite3 $f 'VACUUM;'; done
@Richard Rebel: Nice tip, there are indeed other applications who suffer from this. On OS X Tiger, example number 1 being Apple Mail..
Reactie van RubenV
@Tom: Unfortunately, you forgot quoting as well: Application Support contains a space, which won't work. So substitute it for Application\ Support.
Reactie van Delta
I couldn't get
find ~ -name '*.sqlite' -exec sqlite3 '{}' 'VACUUM;' ;
to run, so I had to add a backslash ( '\' ) to the last semicolon ( ';' ):
find ~ -name '*.sqlite' -exec sqlite3 '{}' 'VACUUM;' ;
Nice tip, though; thanks!
Reactie van Tom
Bummer, I did copy-paste the wrong snippet! Thnx for correcting my corrections ;-)
Reactie van Peter
@Richard Rebel
The problem is running from a cronjob is that you probably want to make sure the appropriate applications are closed first.
It would also help speed up the new summaries in evolution I think.
Also I believe this is on Mozilla's ToDo list but they had issues with doing it automatically that are yet to be resolved.
Reactie van Roshan
Holy Jesus! That was one hell of an improvement! Thanks!
Reactie van Derek A. Muenzel, Sr.
Not a complete windows HOWTO but this will get you there:
1) Download the Precompiled Binaries For Windows http://www.sqlite.org/download.html.
2) I extracted the file to C:bin.
3) Change into the directory containing the .sqlite files. Example: cd C:Documents and SettingsrootApplication DateMozillaFirefoxl89ueo7d.default
4) Get a before shot: dir *.sqlite
5) Run the VACUUM: for %f in (*.sqlite) do C:binsqlite3.exe %f "VACUUM;"
6) Get an after shot: dir *sqlite
My results:
BEFORE
11/25/2008 01:39 PM 7,168 content-prefs.sqlite
01/04/2009 08:15 PM 178,176 cookies.sqlite
01/06/2009 11:54 PM 744,448 downloads.sqlite
01/06/2009 11:54 PM 576,512 formhistory.sqlite
01/02/2009 05:14 PM 191,488 kongregate.sqlite
11/03/2008 02:37 PM 2,048 permissions.sqlite
01/06/2009 11:54 PM 50,679,808 places.sqlite
08/06/2008 01:11 PM 2,048 search.sqlite
12/30/2008 05:43 PM 4,096 webappsstore.sqlite
AFTER
01/07/2009 12:38 AM 7,168 content-prefs.sqlite
01/07/2009 12:38 AM 99,328 cookies.sqlite
01/07/2009 12:38 AM 389,120 downloads.sqlite
01/07/2009 12:38 AM 558,080 formhistory.sqlite
01/07/2009 12:38 AM 186,368 kongregate.sqlite
01/07/2009 12:38 AM 2,048 permissions.sqlite
01/07/2009 12:39 AM 42,889,216 places.sqlite
01/07/2009 12:39 AM 2,048 search.sqlite
01/07/2009 12:39 AM 2,048 webappsstore.sqlite
Reactie van jshare
For windows:
* get sqlite3 from here:
* http://www.sqlite.org/sqlite-3_6_7.zip
* http://www.sqlite.org/sqlitedll-3_6_7.zip
* unzip them both into c:windowssystem32
* cd to your profile directory (there may be an easier way to specify this from the commandline, but I don't know cmd globbing that well)
* for %f in (*sqlite) do sqlite3 %f "VACUUM;"
* note: quotes instead of apostrophes
Reactie van Lee Willis
On Windows you'll probably have to install sqlite3 (http://www.sqlite.org/download.html)
Then (Assuming that the binary is in your Windows path) you can change to the Mozilla Profile directory
C:Documents and Settings<Your Windows Username>Application DataMozillaFirefoxProfiles<random digits>.default/
and run:
sqlite3 places.sqlite "VACUUM;"
Replacing places.sqlite with the file you want to compact - sorry I'm not familiar enough with Windows scripting to work out how to automatically do it for every file - for me the only large sqlite files were:
- places.sqlite
- urlclassifier2.sqlite
Reactie van Pacho Ramos
To Richard Rebel:
About adding it to a cron job, Should script check if any firefox instance is running? Would it break "something" if it's run while firefox is running?
Thanks for information
Reactie van Jeremy
sqlite has correct locking and database semantics, so you should be able to do this with firefox running.
Reactie van Pacho Ramos
OK, thanks for the info :-)
Reactie van Bill
There should be an addon that does this once a month or so, as a stopgap before it's added into Firefox (or Gecko) proper.
Reactie van SchAmane
WOW, thanks for this tip!
Reactie van Marius Scurtescu
@Jeremy
Not sure about sqlite having correct locking and database semantics, but you definitely get an error if Firefox is running: "SQL error: database is locked".
Got that on both Linux and Mac OS X.
Reactie van Andrew Conkling
Marius: Jeremy's tip about it running this command with Firefox running still is sorta valid; it won't optimize Firefox's databases, but it won't harm them either.
So if you're setting up a cron job, it will do its thing on whichever databases are available. It's not the kind of thing you'd need to run every day, so just make sure you have Firefox (or your other apps) closed at least sometimes. ;)
Also, this wouldn't pick up any sqlite databases that don't end in ".sqlite", so there could be further gains to be made here. For example, I ran this on Banshee's database (~/.config/banshee-1/banshee.db) and found a decent performance gain in the application.