After running for 7+ hours on a (originally) 500MB → 69GB database, I shutdown plex again, copied the 69GB DB, file, opened it in “Plex SQLite” (important to use the plex binaries I think), and then ran this on that copy:
.open com.plexapp.plugins.library.db.copy
PRAGMA journal_mode=OFF;
PRAGMA synchronous=OFF;
DELETE FROM statistics_bandwidth WHERE account_id is NULL;
VACUUM;
PRAGMA synchronous=FULL;
PRAGMA journal_mode=WAL;
.quit
Then copied the new 500MB DB file back into place. Disabling then re-enabling synchronous and journaling made it take ~30 minutes instead of 7+hours of not completing.
Seemed to work well for me and database looks OK after swapping it back in (still have the original as a backup). May help others if they’re having issues with the amount of time the cleanup takes.
My understanding is it should be fine as long as each operation completes and isn’t interrupted, and it leaves all DB settings back as they were originally at completion.