If you have been using Chromium like me, you know it can get pretty slow on the first start up after a couple of months of usage.
It's mainly because of all the SQLite 3.x databases it uses for history and other settings.
So here's a simple script to defrag and reindex all the databases chromium uses.
1. Install SQLite3 :
1 2 3 4 |
# install sqlite3 pacman -S sqlite emerge sqlite:3 #gentoo aptitude install sqlite3 #ubuntu/debian based |
2. Close Chromium.
3. Execute this in bash :
1 2 3 4 5 6 7 8 |
cd ~/.config/chromium/Default #where recent chromium store its settings # or cd ~/.config/google-chrome* #where Chrome stores it's settings. find -type f -exec file '{}' \; | perl -ne 'print "$1\n" if /(.*?): SQLite/' | while read fname; do sqlite3 "${fname}" VACUUM; sqlite3 "${fname}" REINDEX; done |
VACUUM : The VACUUM command rebuilds the entire database.
REINDEX : The REINDEX command is used to delete and recreate indices from scratch.
4. Results (I ran this a couple of weeks ago so the result isn't as good as it would be the first time. :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
-rw-r--r-- 1 oneofone oneofone 37M Jan 14 17:27 History -rw-r--r-- 1 oneofone oneofone 34M Jan 14 18:01 History ................. -rw-r--r-- 1 oneofone oneofone 39K Nov 23 10:11 History Index 2010-08 -rw-r--r-- 1 oneofone oneofone 9.0K Jan 14 18:03 History Index 2010-08 -rw-r--r-- 1 oneofone oneofone 32M Jan 2 14:12 History Index 2010-09 -rw-r--r-- 1 oneofone oneofone 12M Jan 14 18:03 History Index 2010-09 -rw-r--r-- 1 oneofone oneofone 93M Jan 14 17:29 History Index 2010-10 -rw-r--r-- 1 oneofone oneofone 71M Jan 14 18:08 History Index 2010-10 -rw-r--r-- 1 oneofone oneofone 169M Jan 14 16:06 History Index 2010-11 -rw-r--r-- 1 oneofone oneofone 161M Jan 14 18:20 History Index 2010-11 -rw-r--r-- 1 oneofone oneofone 152M Jan 14 01:43 History Index 2010-12 -rw-r--r-- 1 oneofone oneofone 137M Jan 14 18:22 History Index 2010-12 -rw-r--r-- 1 oneofone oneofone 93M Jan 14 16:16 History Index 2011-01 -rw-r--r-- 1 oneofone oneofone 92M Jan 14 18:24 History Index 2011-01 ................. |