[SOLVED] Database Size Suddenly 13 GIG

Server Version#: 1.41.7.9823
Player Version#:

I don’t know what changed, but it is NOT for the better.

Long story short, I sync all my backups to Google Drive. I received a space warning yesterday and dug into it. I had two previous backups that were 12.5G which I deleted off the disk to remove them from google drive. That is wy eagle eyed people will notice a couple dates missing. I let another back happen last night and now it’s 13G!

I used sqlite-analyzer on the back to identify where all the space is used in the DB file.

STATISTICS_BANDWIDTH.............................. 12588095    98.5%
*** Table STATISTICS_BANDWIDTH and all its indices ****************************

Percentage of total database......................  98.5%

Why all of the sudden is the statistics bandwidth table ballooning up to several gig of size??? I’ve been using Plex for… somewhere nearly a decade I think? I’ve never - NEVER - seen the DB more than a couple hundred meg.

There are many posts about this. There are solutions on those threads.

I see that now. I can’t explain why searching wasn’t helping me before.

@mpalermo73

There is a bug in some 1.41.7 beta releases that caused the massive db growth.

v1.41.7.9799 and v1.41.7.9823 stop the growth, but do not shrink the db back to normal.

Plex will have a fix to shrink the growth in an upcoming release (availability tbd).

To shrink things now, you can use the DBRepair for Plex Media Server tool.

To use the tool, SSH into the NAS, download and run the tool.

STOP Plex Media Server, then use the AUTO option.

The process will take a long time, as in hours. Deleting the statistics is single threaded, using only one CPU core, and Synology NAS have low power CPUs.

This is for an install via Synology Package Center (“bare metal”). If you are using Docker, see the README on GitHub for additional information.

# change to the PlexMediaServer directory. Volume 1 is default, adjust if using different location.
cd /volume1/PlexMediaServer

# download DBRepair.sh, -O means overwrite an existing file if one is present.
sudo wget -O DBRepair.sh https://github.com/ChuckPa/DBRepair/releases/latest/download/DBRepair.sh

# make it executable
sudo chmod a+x DBRepair.sh

# run it (interactive)
sudo ./DBRepair.sh

# can also run non-interactively
sudo ./DBRepair stop auto start exit

FYI, there is another option. It is a little more work, but potentially much faster if you have a system (PC, Mac, etc.) with a faster CPU and SSD.

  1. Install PMS on the PC and claim the server. No need to create libraries, etc.
  2. On the new server, Settings → Library: disable Empty trash automatically after every scan (enabled by default).
  3. Stop PMS on both systems.
  4. Copy the com.plexapp.plugins.library.db and com.plexapp.plugins.library.blobs.db files from the NAS to the PC.
  5. Using Plex SQLite, manually issue the SQLite commands to delete the info from the database.
  6. When finished, copy the db files back to the NAS and start PMS.

See Library.db size more than doubled in latest version - #207 by FordGuy61 for additional information on how to manually run the commands. Three different methods are listed. All work equally well. The DBRepair tool uses #3.

2 Likes

Thank you for putting this all in one place like this. This is immensely helpful. I have ran the repair utility and my DB is down to 187M. It took just under 12 hours.

M.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.