Multiple reasons have been suggested as to what might have caused the bandwidth statistics no longer being stored, by multiple users:
- ran delete-query to remove excessive data from table statistics_bandwidth
- ran PlexDBRepair
- ran Deflate
- shutdown & restart PMS (not a re-install)
- installed a newer version of PMS (just an upgrade with existing data)
The only thing that is consistent in this for multiple users is that a newer version of PMS was installed. Either by explicitly install a new version or by restarting a docker container (which always installs the newest version).
I’m not sure if any of the affected users run or ran the beta version of PMS. I know I did run the beta, but I switched to the stable branch in an attempt to fix this issue and have not reverted back since.
At the time the problem started for the known users, changes were being made to Plex to fix excessive records being inserted in the table statistics_bandwidth in an attempt to fix that issue.
I believe that in the process to fix that issue, 1 or more released PMS versions contained a bug that would break the bandwidth statistics permanently if the user installed that version. That bug has been fixed in a later version, but leaves the users that have run the buggy version with a permanently broken bandwidth history. A lot of users don’t upgrade that often, so this probably only affects a small set of users.
Given this is all related to statistics_bandwidth, there must be a way to check:
- if the table structure is incorrect.
I think this one is a stretch, I don’t see a reason this would have changed.
- records are missing
I suspect PMS depends on records in this table with “account_id=null” for keeping track of historic usage and these records have either been deleted by a user or PMS itself in an attempt to fix the database-too-big-issue.
Both are simple to check, but I don’t know what should be in there by default.
I’m tempted to install a seconds PMS and check that database in an attempt to fix it myself, but I don’t have the time at the moment.
If anybody has a PMS running where the history works normally, I’m really curious at what is in the database for:
- The table structure of
statistics_bandwidth.
- What records exist when the query below is run:
SELECT * FROM statistics_bandwidth WHERE account_id IS NULL
I’m also curious what the nature was of the bug that caused the huge databases.
I suspect PMS stores bandwidth usage per hour when it happens. Then periodically (when they are 7 days, 30 days, 90 days, etc old) those records are combined and put in a record that spans a longer period. There probably was a bug that didn’t delete records after combining them.
All this will probably point us to what the problem is and find a path to fixing it.
I totally agree with @pl71303 that a complete re-install of PMS is simply not an acceptable solution.