Copy the database folder over there. Put it into the same folder structure that it has on your C: drive.
Then pretend to have moved all the other data of your plex data folder as well and make the registry change as explained in [HowTo] An extended guide on how to move the Plex data folder on Windows
But never start Plex server with that registry change in place.
Instead, just use the debloat batch file from above, followed by the repair bat file from DBRepair/Windows at master · ChuckPa/DBRepair · GitHub
Once that is done, copy the de-bloated and repaired database files back to their original place on C:, overwriting the bloated ones.
Then remove the new registry key again.
Only then start Plex server.
Thank you for the detailed instructions! Most of that are things I have never done before, so I will need to research what…that all means lol. And find time to set aside to do it.
“use the debloat batch file from above“
I went to that post - I’ll admit, I am completely lost. I don’t know how to use/run a .bat/batch/script. (That post has a bunch of …code? … that I should… copy into something somewhere to “run” it? And the second bat file linked on github is a .bat file that I … download? and the…run somehow somewhere?).
And I think I’ve made registry changes once or twice in my lifetime, and I know that’s not something to do carelessly, so I will definitely need to make sure I set aside some non-kid-interrupted time for that, when I am alert and mentally energized!
EDIT: Okay and also, further illustrating my amateur/mentally-exhausted status - I’ve used a lot of forums in my lifetime and usually I can figure out the basics on my own… but I cannot for the life of me see how you quote another user’s post in this forum. Am I missing something obvious?
Precisely. If you mouse over the code, there is a “copy all” icon in the upper right corner of the code window.
Use that to put the code into your clipboard.
From there you can paste it into notepad.exe and save it as a .txt file.
The rename it and change the file name extension from .txt to .bat
That bat file can now be double-clicked and executed.
Of course it will only show any messages as long as it’s running. If you want to read any messages and errors it may produce, you must learn the very basics of the DOS command line prompt and run the bat files inside of cmd.exe.
That being said, if there are no errors, the bat files will still do what they were designed to do anyway.
(I found the “quote whole post” option! little wins lol…)
Great, thanks - that all makes sense, appreciate the 101 instructions.

I’ve used a lot of forums in my lifetime and usually I can figure out the basics on my own… but I cannot for the life of me see how you quote another user’s post in this forum.
That is very convenient in this forum. Just try selecting the text you want to quote with your mouse pointer.
This is heinous!
-rw-r–r-- 1 plex plex 289M May 13 02:00 com.plexapp.plugins.library.db-2025-05-13
-rw-r–r-- 1 plex plex 3.5G May 16 02:03 com.plexapp.plugins.library.db-2025-05-16
-rw-r–r-- 1 plex plex 44G Aug 17 22:02 com.plexapp.plugins.library.db
I have deleted two ~40gb backups just to get my system working again because my disk was full.
How is there not an update which has fixed this? We should not be using debloat scripts and sqlite3 consoles.

How is there not an update which has fixed this?
There is. The debloat script is just quicker.
As far as I can tell, 1.41.7.9784 was only available in the beta/experimental branch.
If you are too afraid of running a console script… you should leave the experimental branch.
Also if you update to public branch, it will resolve automatically.
I am on the public release channel via apt, I don’t believe I’m using a beta nor experimental version:
# /etc/apt/sources.list.d/plexmediaserver.list
deb [arch=amd64 signed-by=/usr/share/keyrings/plexmediaserver.gpg] https://downloads.plex.tv/repo/deb public main
The root cause of the bloat may be fixed, preventing recurrence, but that doesn’t seem to solve the issue once present. This bloat is severe enough that I would expect Plex to proactively repair the bloat, including across backups, not allow attrition to fix the issue over time.

The root cause of the bloat may be fixed, preventing recurrence, but that doesn’t seem to solve the issue once present.
Yes, it does. The code was added in 1.42.0 AFAIR (maybe even earlier). It is running during the maintenance time window.
However, it is much slower than the script. And it might fail if there is not enough free space in the plex data folder volume.

The root cause of the bloat may be fixed, preventing recurrence, but that doesn’t seem to solve the issue once present.
For those looking for the scripts:
- Linux Script: Library.db size more than doubled in latest version - #357 by ChuckPa
- Windows batch file: Library.db size more than doubled in latest version - #410 by OttoKerner
To add to OttoKerner’s comments…
Reiterating that the debloat script is much faster than letting PMS perform the process.
When using the debloat script, Plex Media Server is shutdown and the database is closed. This lets the script take actions and use SQLite commands that are not possible when Plex Media Server is running and the database is open.
Another advantage of the script is that it does not require as much free space to debloat the database. As long as the drive/partition is not completely full, the script generally has room to work. When Plex Media Server is cleaning the library it requires as much empty space as the bloated database. During the process, the -wal db file grows to the size of the bloated database before the main db is reduced in size. If the space is not available, then the process will fail.
Regarding letting PMS clean the database:
Plex Media Server will clean the database if these conditions are met:
- Optimize database every week is enabled in Settings → Scheduled Tasks
- The maintenance window is wide enough for Plex to reach the Optimize Database task in the time allowed (once the task starts it will run to completion even if the window closes)
- Enough space exists on the drive/partition holding the database files. Slightly more than the size of the bloated database is required. If needed, relocate or delete database backups to clear space.
It will take much longer than the debloat script, and Plex Media Server will be non-responsive during the cleaning process (no streaming, clients will time out trying to connect, etc.).
The Database Optimization scheduled task can be initiated immediately instead of waiting for it to run once per week.
To initiate via a POST or curl command, see Library.db size more than doubled in latest version - #302 by drzoidberg33.
To initiate using WebTools-NG, see Library.db size more than doubled in latest version - #286 by FordGuy61.
That script absolutely saved me. I’ve always kept my Plex server software (Windows) updated but it still got bloated and was still enormous to the tune of 31GB.
After running the script, which took about 90 minutes, the DB was down to 65MB. Now I can finally scan my library without any problems.
Thank you!