Library.db size more than doubled in latest version

Edit:

@TeamThynne

I ran a test with my Windows desktop.

PMS 1.41.8.9834 cleaned the database when running Optimize Database as a scheduled task. Manually initiating a database optimization via Settings → Troubleshooting did not do so.

While the process is running, the Activity icon in Plex Web shows that a database optimization is underway.

When complete, the database file is returned to its normal size, and the -wal file is roughly the size of the db file when it was bloated.

Stop PMS to remove the -wal file (this is normal, bloated or not). Then re-start PMS.

According to Settings → Library, Plex will optimize the database once per week.

If desired, you can start the process early by using WebTools-NG

In the Butler Scheduled Tasks section, select the Optimize Database task. This starts the same database optimization process as if you waited for PMS to run the task.

PMS will be non-responsive while the optimization is underway and assume it may take hours to complete, so time things accordingly.

FWIW, it took almost an hour to reduce a ~30GB db to ~200MB on my PC with the OS & Plex Data Folder on an SSD. The process would take longer if the db was on a hard drive.

4 Likes

I’m at 600 GB for my database, hopefully gets smaller sooner or I’ll need another SSD just for Plex…

Idk why, but I am just running Docker stable latest, and my database sizes have ballooned 50x. It has filled up my whole SSD. When will this be fixed? Optimize database just crashes Plex entirely.

@CrazyPhil @xHyperElectric

See my post immediately above.

You need ~2x the size of the bloated db for temp/working files. Delete the database backups (with the date appended) if necessary to free up space. The database files are in the /Plug-in Support/Databases folder of the Plex Data Folder.

WebTools-NG is Windows only. If running PMS on Linux/Mac, you can run it from a PC on the same network.

Correction: WebTools-NG runs on Windows, Mac, & Linux.

It communicates with Plex Media Server via API calls.

Technically, it’s not crashing plex, it’s still running, but plex will be unresponsive to requests until it’s done. There’s a difference.

Check your “Server update Channel,” at Server Name > Settings > General my docker server set to public has been fine, but my beta server grew 40x.

Hi guys
I’ve discovered that my Plex has ballooned recently as well, I’m on the beta update channel (now changed to public to hopefully avoid in the future!)
This is a screenshot of my Plex folder from TreeSize Free;


What is the safest way to get rid of that bulk without risking knackering my Plex db? I have Plex running on WIndows 11 (not Docker).
Thanks

Mine is running on docker (binhex-plexpass : 545 GB), my Plug-in Support/Databases is only 102 GB.

  • Other folders of large size -
    Metadata: 385 GB
    Transcode: 37 GB
    Media: 13 GB
    Cache: 3 GB

No matter what I did, I just could not get the Plex SQLite to let me edit the database inside the docker container. (It had to be a permissions issue I just didn’t feel like tracking down)

What I ended up doing, that has worked bought my Database from 31GB back down to ~450MB was:

  1. Install Plex Midea Server on a local Windows machine and stop the service.
  2. Stop the Plex Media Server Docker Container
  3. Copy The com.plexapp.plugins.library.db from your Docker Container Appdata to your %LOCALAPPDATA%\Plex Media Server\Plug-in Support\Databases\ folder on the machine which you just installed PMS
  4. Change the permissions of the File and add everyone with Full control
  5. Run the steps outlined in @twig123 's post here Library.db size more than doubled in latest version - #206 by twig123
  6. Edit file permissions again and remove the Everyone Perms
  7. Copy the new com.plexapp.plugins.library.db file back to your original containing folder for PMS’s appdata folder for your Docker container, make sure to rename/remove the old file.
  8. Start the Plex Media Server Docker Container, and enjoy the fact you fixed an issue that should’ve never existed…
2 Likes

Sorry, it was the combined files in that directory. I should have made that distinction.

1 Like

I am having the same problem with the .db size really really huge

I don’t mind waiting, but the thing I’m noticing is that my Plex says “backing up database” for hours and hours now. Obviously 43 GB is a huge size so that’s why it’s taking that much time. Can I stop this process safely some way?

I have already unchecked the backup database every 3 days option, and I’m waiting for the optimization thing to do its job automatically.

Also, is there a way for me to run this optimization manually ? My Plex is running in a docker container on my Synology NAS if that matters at all.

The version of Plex my server is currently running is 1.41.8.9834 and it says “up to date”. I read some of the above replies but it seems like the manual optimization tool is for only Windows/Mac/Linux devices?

If there is a way for me to run the optimization manually on my NAS/Docker, please let me know. I don’t want it to start at any random time and disrupt the viewing of me and my friends/family so I’d rather run it manually at night.

Any help is appreciated. Thank you!

Not safely. You will end up with a damaged db file.

There are several approaches mentioned already above.

I just noticed the automatic backups are not working anymore since I did the delete and vacuum. Is there a log file that contains the reason? I suspect I’ll need to repair the database.

Running 1.41.8.9834 with the LinuxServer.IO docker image on UnRAID.
Scheduled Tasks ran last night and my database is still bloated at 33 GB and I have 4 days of backups at 33 GB as well.

What is the full proof recovery method to resolve this bloat issue manually if its not getting getting fixed via Scheduled Tasks?

When I try and delete the older DB backups so I can reclaim space, they regenerated immediately upon folder refresh.

@ChuckPa - How do I get your repair tool copied into an UnRAID docker from Mac? I’m not having any luck getting the file moved over.

The Optimize Database scheduled task reduces the database size. It runs once/week.

Selecting Optimize Database from Settings → Troubleshooting does not reduce the database size (it did not on my Plex server).

You can use WebTools-NG Butler Scheduled Tasks to start the scheduled task immediately.

WebTools-NG runs on PC/Mac/Linux (download). It does not have to run on the same system as Plex Media Server.

You will need some free space. During the process, the -wal database file grows to the same size as the bloated db.

That’s Docker or UnRAID, not Plex. Hopefully someone familiar with them can assist.

Thank you, not having much luck with other methods either, so will give this a go!

Thanks for the tips @FordGuy61 - I managed to clear the extra backups using the UnRAID Terminal instead of using MacOS Finder (can’t believe that mistake was hanging me up)

Using WebTools-NG right now to kick off the Optimize Database command.

Fingers crossed this works on getting back down to normal sizes!

UPDATE

So I managed to get back to normal sizes (so I hope - still gonna poke around with this), but this is how I did it in case there is another UnRAID / LinuxServer.IO Plex user out there.

1.) I logged into UnRAID Terminal and deleted 2 of the 4 oldest Plex backup files to help get some breathing room since all my backups were bloated and 33 GB each.

com.plexapp.plugins.library.db-2025-05-27
com.plexapp.plugins.library.db-2025-05-24

and

com.plexapp.plugins.library.blobs.db-2025-05-27
com.plexapp.plugins.library.blobs.db-2025-05-24

This left me with my backups from 2025-06-02 for both files and the current use files.

2.) Followed FordGuy61 suggestion on using WebTools-NG to force the Optimize Database function to kick off immediately

3.) It ran and you’ll see the activity meter reflect on the Plex Dashboard as the Optimize Database function runs. You can also watch your Plex database folder in Finder if you’re a MacOS user as your com.plexapp.plugins.library.db-wal file slowly increases in size to match your bloated database file size (it took 2 hours for mine)

IMPORTANT: Your Plex server will stop working and your content will not be viewable due to the database being tied up with optimization. At some point the Plex activity indicator disappeared and I just kept an eye on the database folder in Finder to tell me if the function was till in progress - Do not panic or mess with it - just let it do its thing!

Once it finished (2 hours later), my Plex server content was viewable and accessible again - no server restart was needed and it refreshed on its own.

My database file shrank back down to 1.6GB from 33.7GB

Now I’m curious if there any value in using ChuckPA’s DBRepair tool for additional database optimization or clean up? I did manage to get the tool into the docker container.

Good to read you’re back up and running.

Did the -wal db file also shrink to normal size (normal = not 33.7GB)? If not, stop Plex Media Server. The -wal file should disappear, then reappear as a small file when you relaunch PMS.

Yes, as part of normal server maintenance. I run it about once per month.

DBRepair will detect and try to correct any database corruption it finds. Since PMS is offline and the db closed, DBRepair can also perform a more thorough job of optimizing the database than PMS.

Note: DBRepair will not reduce the db bloat. It had that capability at one time, but Chuck removed it once Plex added their fix to Plex Media Server 1.41.8.9834.

Be careful accessing the Plex Data Folder through Finder. If it has a separate mount point from your media files, consider unmounting it.

The Plex Data Folder should be considered somewhat fragile. Changing ownership or access permissions to the folders and files could cause problems for Plex. Modifying the database over a network connection (SMB or NFS) can cause database corruption.

Do we know when 1.41.8 is going to be pushed to plexinc/pms-docker?

I have waited a long time for my DB to shrink. But the latest build does nothing.
I have left the server alone, so it can run its tasks undisturbed, but I have now multiple large db files.
server version: 1.41.8.9834