Also, I'm assuming this has to be done after every update, and since Spotify auto-updates, not so convenient...
Also, I'm assuming this has to be done after every update, and since Spotify auto-updates, not so convenient...
Spotify stores a local SQLite database file (by default on a Mac it's at ~/Library/Application Support/Spotify/PersistentCache/mercury.db )
The file is only about ~100MB (on my computer). With databases, you issue a vacuum command to defragment a database (reclaim space from deleted/updated rows, re-sort the data, etc). SQLite's VACUUM behavior basically just recreates the entire database from scratch in a temp file, then replaces the live file with that[1]. It makes the file smaller and more efficient to run queries against. Spotify must be triggering a VACUUM statement too aggressively (possibly after every change), rather than on a periodic schedule or after a certain amount of fragmentation. By breaking the VACUUM statement with this solution, you prevent the database from getting recreated so frequently. The file itself will grow slowly (since you're not reclaiming free space like a VACUUM would) and possibly slow down queries against the database, but that sounds like a far better tradeoff than excessive wear on the drive from recreating the file so often.
sqlite3 mercury.db vacuum;
from
https://sqlite.org/download.htmlOn the other hand it fits the picture: Their clients/apps on multiple platforms are very underwhelming. The abandoned rdio apps back from 2014 (or when did they close?) would offer a better experiment in almost any aspect.
if (time_since_last_vacuum > 3600 /* seconds */) {
go_hogwild_on_io();
} else {
be_nice();
}It is disheartening to those of us who enjoy writing decent software, particularly decent native software.
Think of it roughly as defragmentation. You're trading work (in the form of writes and CPU) for reclaimed space.
Unless SQLite has some semantics around it, replacing it with "xxxxxx;" will likely just cause it to run a bad command...might be more correct to replace it with something like "------;" (comment characters).