I found 15GB large file in ~/Library/Safari called ContentBlockerStatistics.db-wal. What is that and what to do with it?
TL;DR
-
~/Library/Safari/ContentBlockerStatistics.db-wal
is the log file for~/Library/Safari/ContentBlockerStatistics.db
- It can't be read directly and gets emptied once you quit Safari.
-
~/Library/Safari/ContentBlockerStatistics.db
can be read withsq3lite
- If
~/Library/Safari/ContentBlockerStatistics.db
grows too big it can safely be removed while Safari is not running
Using the standard tools of macOS
$ file ContentBlockerStatistics.db*
ContentBlockerStatistics.db: SQLite 3.x database, user version 1, last written using SQLite version 3032003
ContentBlockerStatistics.db-shm: data
ContentBlockerStatistics.db-wal: SQLite Write-Ahead Log, version 3007000
So ContentBlockerStatistics.db
is a database and the -wal
file is the write-ahead log where all DB changes are written to while Safari is running. You can't browse the write-ahead log and the DB is locked while Safari is running. If you close Safari the write-ahead log content gets emptied.
$ file ContentBlockerStatistics.db*
ContentBlockerStatistics.db: SQLite 3.x database, user version 1, last written using SQLite version 3032003
ContentBlockerStatistics.db-shm: data
ContentBlockerStatistics.db-wal: empty
To see what's inside ContentBlockerStatistics.db
use sqlite3
(or any third-party MySql browser).
$ sqlite3 ContentBlockerStatistics.db
SQLite version 3.32.3 2020-06-18 14:16:19
Enter ".help" for usage hints.
sqlite> .schema
CREATE TABLE FirstPartyDomains (firstPartyDomainID INTEGER PRIMARY KEY AUTOINCREMENT,domain TEXT NOT NULL UNIQUE ON CONFLICT FAIL);
CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE ThirdPartyDomains (thirdPartyDomainID INTEGER PRIMARY KEY AUTOINCREMENT,domain TEXT NOT NULL UNIQUE ON CONFLICT FAIL);
CREATE TABLE BlockedResources (firstPartyDomainID INTEGER NOT NULL,thirdPartyDomainID INTEGER NOT NULL,lastSeen REAL NOT NULL,FOREIGN KEY (firstPartyDomainID) REFERENCES FirstPartyDomains(firstPartyDomainID) ON DELETE CASCADE,FOREIGN KEY (thirdPartyDomainID) REFERENCES ThirdPartyDomains(thirdPartyDomainID) ON DELETE CASCADE,PRIMARY KEY (firstPartyDomainID, thirdPartyDomainID));
-
FirstPartyDomains
seems to contain the domains you visited -
ThirdPartyDomains
seems to contain any domains referenced from the first party domains