Oh ok, Then the database must have reached that size before I downgraded.
Is there any way to “clean” the database? I am not good at SQL so I dont think I can go into the file and do stuff.
As was mentioned earlier if you can live with the database size as it as for the next 30 days it automatically gets condensed.
EDIT: although with my scenario after an additional 500m rows had been added I’m not sure how quick this process would be
Never mind
After investigating the issue further I actually don’t think the automatic pruning will help here.
The best solution for now is to manually delete the rows in the statistics_bandwidth table.
I’m working on looking at adding a database migration to do this on a PMS update, but if you feel comfortable doing it yourself then you can just run this command from the SQLite command line (see here on how to access this: https://support.plex.tv/articles/repair-a-corrupted-database/)
Always ensure PMS is not running when doing this.
delete from statistics_bandwidth where account_id is NULL;
then run:
VACUUM;
This may take a while, just be patient.
Is this the root cause for all of the instability of the latest betas? I had to downgrade to the latest stable as i found PMS was hanging and becoming entirely unstable.
Ok, I downgraded to 1.41.7.9799 and overnight my db went from ~14GB to over 19GB.
I just uninstalled the week old beta and installed the current released build - Version 1.41.6.9685.
Plex has become so slow and unresponsive - I have to keep restarting PMS just to get use it. ![]()
Sorry for bringing this up again, but does anyone know what happens to orphaned files when you revert to a backup of your database?
I mean all the thumbnail files, posters, backgrounds, etc - what happens to those and other files that no longer are matched to a video?
Many of the videos I added over the weekend are using the legacy Plex Movie Scanner.
Voice index, credits index, etc etc.
For example, if I move one of these videos to a new location, modify it’s name, etc, it creates a new entry in Plex and leaves the old one and it’s associated data behind.
Yeah, I misread things, so I deleted my reply.
See Troubleshooting. If I read that correctly, Cleaning Bundles will remove those files.
You should probably scan libraries & empty trash first (like part of the Plex Dance).
I thought cleaning bundles only removed bundles from files/videos that exist in your libraries?
With the number if files I currently have, my frequent/religious edits to the MP4 metadata, daily TV episodes, etc, I empty the trash and clean multiple times a day and optimize the database at least every 2 days.
Thanks for the link, that helped.
It seems like it Cleaning Bundles only works for videos in your existing library(ies) and will not remove/delete orphaned files.
That’s an interesting question. How would Plex know to clean the files if the media were never in the database?
Someone more familiar with the product than I am will have to answer that.
Thanks for your help and ideas. I have a backup of my entire 3.4.TB Plex data folders from before this issue occured.
Two things are preventing me from rerouting my Storage Manager links to the backup.
- It’s 2 TB SSDs as a single 4 TB drive using DrivePool (I’m concerned for Plex will behave, or crash in this situation)
- I don’t want to lose 5 days of updates and edits unless I absolutely have to!

Wait, is this how it works? I was told by one of the mods when I asked this before that Clean Bundles basically prunes the folders, and I specifically used the term orphaned files.
Here’s my post asking about it back in 2023 Does Plex clean up the Plex metadata folder? Even orphaned files?
for what it’s worth – this purge reduced my plex library db by 75%.
@drzoidberg33 : any chance there might be interest internally in putting stats in its own DB? I’m sure you don’t lookup on account_id often, but i think it was not indexed – obviously the delete + vac takes a while.. but is there any chance that large (and probably noisy-on-disk) data would impede other (unrelated) queries? I’ve had a lot of slow query logging of late.
Doing so would instantly remove pretty much all metadata that are not stored directly in the database file. Think of all the different poster motives, chapter thumbnails, scrobble previews etc.
So that would make no sense.
This action is specifically to remove all the bundles which are “orphaned” – i.e. which don’t have a corresponding record in the database.
This is the closest I have seen to an actual answer.
So, you you are saying that if I place a few photos or other files in these directories they will be deleted the next time I Clean Bundles and then empty the trash?
You are not supposed to place anything in there. We are talking about subfolders inside of the Plex data folder, which you should not add-to or manipulate in any other way.
I understand the folders you are taking about. - every time I backup those folders there are 80K +/- files backed up or deleted.
That’s why I would like a specific answer to my question…
What does Plex look for during Bundle cleaning? Is it looking at file types? Or is it looking for every fully that does not have an entry in the db?
I’ve had Plex running shortly after Windows Media Center went dark (Windows 11 hack) and I want to make sure that I don’t add garbage into these folders every time I need to restore from a backup.
If I’m to believe Microsoft CoPilot, if I backup Plex on Monday, add 1500 files between then and Friday; my system crashes and I restore Mondays backup, all the metadata and associated files are left behind and Cleaning Bundles will not find or delete those files.
It said you have to manually delete them from the folder.
If it’s right, it’s what I expected and answered my question.
