Here is how I solved my large snapshots.db problem. First, I tracked it to an excessive number of ‘freelist pages’. The snapshots.db file is an sqlite database. It accumulates ‘pages’ of system statistics for several days and then begins deleting old entries, but those pages are not actually deleted and returned to free disk space. Instead, they are kept in the file as freelist pages to be filled with subsequent data. Thus, the file doesn’t shrink as old entries are deleted. In my case, the file grew to over 2 GB. At some equlibrium point it stops growing because there are always enough freelist pages to accomodate new entries.
You can find out the number of freelist pages by typing this command in the terminal from an administrator account (you’ll have to enter your password when prompted):
sudo sqlite3 /private/var/db/systemstats/snapshots.db "PRAGMA freelist_count;"
This returned > 400000 in my case. If the same is true for your situation, then the following procedures might help:
A temporary solution to ‘vacuum’ the freelist pages was contributed by Linc Davis (https://discussions.apple.com/thread/5735772):
sudo sqlite3 /private/var/db/systemstats/snapshots.db "vacuum;"
This works, but the file then just resumes growing. The command can be repeated when the file seems too big, but I grew tired of monitoring it.
A permanent solution is to set the snapsjots.db file to ‘auto_vacuum’ mode, in which freelist pages are automatically returned to free disk space as old data is deleted. To do this, you vaccum the file, then set auto_vacuum=1 and then immediately vaccum it again. Once this is done, you no longer have to manually vaccum. My snapshots.db file now varies between 0 - 300 MB, depending on recent computer use. The procedure I used follows:
In the terminal, type
sudo sqlite3 /private/var/db/systemstats/snapshots.db
This opens the sqlite3 command line interface. You should see something like:
SQLite version 3.7.13 2012-07-17 17:46:21
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>
Now, at the sqlite> prompt, type:
VACUUM; PRAGMA auto_vacuum=1; VACUUM;
The process may take a while to complete and will end by returning the sqlite> prompt. You can then check the freelist page count and auto_vacuum status by typing:
PRAGMA freelist_count; PRAGMA auto_vacuum;
This should return:
0
1
sqlite>
You can then exit the sqlite command line interface with ctl-D. You can learn more about sqlite commands at: https://sqlite.org and https://www.sqlite.org/sqlite.html
Good Luck!