SQLite
Vacuum Firefox database for better performance
Find the .sqlite database files in Firefox Profile folder
Linux
for s in *.sqlite; { sqlite3 $s vacuum; }
Mac OS X
for s in *.sqlite; { sqlite3 $s vacuum; }
Windows
for %a in (*.sqlite) do (sqlite3 %a vacuum)
Note: download sqlite binary first to get sqlite3.exe.
Chrome
Chrome Profile directory on Linux: ~/.config/google-chrome/Default
Purpose: Backup file Web Data and restart chrome. Web Data contains the keywords.
Export keywords table and import it into the new Web Data database
sqlite3 Web\ Data '.dump keywords' | grep '^INSERT' > keywords.sql
To get a CSV file, which can be imported into almost everything
.mode csv .header on .out keywords.dump select * from keywords;
If you want to reinsert into a different SQLite database then
.mode insert .out keywords.sql select * from keywords
Other forms
sqlite3 database.db3 .dump | grep '^INSERT INTO "tablename"' sqlite3 database.db3 .dump | grep '^INSERT INTO "tablename"' sqlite3 database.db3 '.dump "table1" "table2"' | grep '^INSERT'
OR
sqlite3 database.db3 '.dump "table1" "table2"' | grep -v '^CREATE'
Reference:
http://kb.mozillazine.org/Profile_folder_-_Firefox
http://sqlite.org/lang_vacuum.html
http://mozillalinks.org/wp/2009/07/vacuum-your-firefox-databases-for-better-performance/