Jump to content

Large Library.db file?


Go to solution Solved by Lessaj,

Recommended Posts

Posted

So recently my emby server has been running very slow. Recently watched isn't loading and sometimes even the libraries won't load. I checked my db file and it was 66GB. I ran the vacuum last night and it went to 55. So i re-created it today and its now at 29GB. I upgraded my server from 32GB to 64Gb of ram and Emby is still trying to take 14GB+ without any streaming happening. 
I realized all this because I went to increase my database cache size and there was a post saying 1.5-2x the library.db size, but 120GB of cache isn't possible.

My library size is ~1200 movies and 15.4k episodes. 

Does that db filesize seem correct? If not what log files would you need to look at to help with me solve this issue?

Server Specs:
Ryzen 9 5900X

64GB DDR4 Ram

2x 3080 1x3090 

2.5gbps network connection to nas with movie/TV show data

Happy2Play
Posted

The old method of 1.5 to 2x the db size is obsolete as now there are multiple db connections.

So in your case 5 connections x 2GB cache size just for the library.db.

You need to reset your library cache to default 128.

Happy2Play
Posted
2 hours ago, Coolbule said:

I checked my db file and it was 66GB.

My library size is ~1200 movies and 15.4k episodes. 

Does that db filesize seem correct?

With those numbers no.  As I have about 7000+ movies and over 50,000 episodes and my library.db is only about 485MB.

  • Agree 1
Posted

Your DB seems massive to me, I don't even think it should end up being that large. My DB is only 559 MB with twice as many movies, 3x as many episodes, and 20k songs. What do you mean by recreated it? What did you do?

  • Agree 1
Posted

Hmm how many extras do you have in your library?

 

Posted (edited)
16 minutes ago, Lessaj said:

Your DB seems massive to me, I don't even think it should end up being that large. My DB is only 559 MB with twice as many movies, 3x as many episodes, and 20k songs. What do you mean by recreated it? What did you do?

 

I deleted the library.db and re-created the libraries on emby server

I also don't have many extras

Edited by Coolbule
  • Like 1
Happy2Play
Posted

Are you sure it is GB and not MB?

Posted
13 minutes ago, Happy2Play said:

Are you sure it is GB and not MB?

Unfortunately I did double check my commas

image.png.26db46b02c95972fa857f1e947932ce1.png

Posted

Hmm what is corrupting your db?

image.png.abc1415a4c448e7941d9d49ac64329ea.png

Guess we need logs from recreating your library.db to see that's going on.

Is your db drive showing smart errors?

Posted
1 minute ago, Neminem said:

Hmm what is corrupting your db?

image.png.abc1415a4c448e7941d9d49ac64329ea.png

Guess we need logs from recreating your library.db to see that's going on.

Is your db drive showing smart errors?

so i saw in the docs somewhere to get emby to recreate just rename is .corrupt, so that's what i did, it didn't do that itself.

 

Do you know which logfile would show the recreating the db?
Its on a windows server and crystal disk shows 0 errors atleast for the drive emby server is on

Happy2Play
Posted

Yes the KB mentions renaming.  

As for log it would be when you renamed the db and started Emby again to scan all your content.  But if you only have the content numbers listed there is something way off with the db.

Happy2Play
Posted (edited)

But per your recreation log you have 5 libraries.

	Line    494: 2025-12-04 04:28:53.699 Info App: Creating folder in database Movies - Z:\Movies
	Line   1554: 2025-12-04 04:30:17.441 Info App: Creating folder in database TV Shows - Z:\TV Shows
	Line   2173: 2025-12-04 04:31:19.046 Info App: Creating folder in database Recordings - Z:\Recordings
	Line   2980: 2025-12-04 04:32:40.075 Info App: Creating folder in database Audio Books - Z:\Audio Books
	Line   5209: 2025-12-04 04:34:46.395 Info App: Creating folder in database Family Videos - Z:\Family Videos

So anything is possible per your content but still think that is extreme for library.db especially for a recreation as I can sort of understand a really old db that has ben migrated having obsolete tables.

Edited by Happy2Play
Posted (edited)
10 minutes ago, Happy2Play said:

Yes the KB mentions renaming.  

As for log it would be when you renamed the db and started Emby again to scan all your content.  But if you only have the content numbers listed there is something way off with the db.

This morning around 6 in that log above should be in the middle of that first scan

Edit: right after i renamed the .corrupt file is when i started creating and re-scanning the new libraries, which would be the start of the log file above.

Edited by Coolbule
Posted
41 minutes ago, Happy2Play said:

But per your recreation log you have 5 libraries.

	Line    494: 2025-12-04 04:28:53.699 Info App: Creating folder in database Movies - Z:\Movies
	Line   1554: 2025-12-04 04:30:17.441 Info App: Creating folder in database TV Shows - Z:\TV Shows
	Line   2173: 2025-12-04 04:31:19.046 Info App: Creating folder in database Recordings - Z:\Recordings
	Line   2980: 2025-12-04 04:32:40.075 Info App: Creating folder in database Audio Books - Z:\Audio Books
	Line   5209: 2025-12-04 04:34:46.395 Info App: Creating folder in database Family Videos - Z:\Family Videos

So anything is possible per your content but still think that is extreme for library.db especially for a recreation as I can sort of understand a really old db that has ben migrated having obsolete tables.

i have about 50TB total of movies/tv shows/etc mostly non-compressed straight rips. Then creating the new db today should have fixed that old stuff right?

Posted
Quote

but 120GB of cache isn't possible.

You basically would just do as much as you're willing to allocate.

Posted
1 minute ago, Luke said:

You basically would just do as much as you're willing to allocate.

the biggest problem is my whole server has been slowing down because of this basically to a crawl where the libraries don't even load for a couple minutes. But it does seem like that file is too large for the amount of content I have?

Posted

I'm wondering if you delete all your libraries how large the DB file would be at that point since it should be basically empty? I believe there are a few settings that get stored there, and then without any content in libraries there might be people information leftover but again I can't imagine 40+ GB of metadata for people being stored in the DB.

I looked briefly at your log file and I think your organization and renaming of files could use some work, but that still shouldn't cause the library file to be that large, you simply don't have enough content for that. The size of the content is irrelevant it's going to come down to number of items to store data for, and we've shown that our libraries with double to triple the number of items are minuscule by comparison.

Posted

Just another reference point, from a fresh install of 4.9.1.x (ie not upgraded from a previous installation, started from scratch)

5400 movies, 32,500 tv eps and 31,800 music files

Library.db is 386MB

Posted (edited)
35 minutes ago, Lessaj said:

I'm wondering if you delete all your libraries how large the DB file would be at that point since it should be basically empty? I believe there are a few settings that get stored there, and then without any content in libraries there might be people information leftover but again I can't imagine 40+ GB of metadata for people being stored in the DB.

I looked briefly at your log file and I think your organization and renaming of files could use some work, but that still shouldn't cause the library file to be that large, you simply don't have enough content for that. The size of the content is irrelevant it's going to come down to number of items to store data for, and we've shown that our libraries with double to triple the number of items are minuscule by comparison.

I can try that, should i delete/.corrupt my current db then just restart emby or just remove the libraries and see what happens?

 

I'm not against re-installing the whole emby server stuff again....I just also want to make sure this doesn't continue to happen

Edited by Coolbule
Posted

I think it would be best to do in stages.

Take note of the current size, delete one library, check the size, repeat. May take some time to actually delete the content from the DB and may also be a good idea to run a library scan inbetween each deletion as well, so make sure to check the log file. This may help to narrow down a particular offender library, and also keeps the people in the DB so when everything is gone content wise there should be little that remains.

If it is still very large after everything has been removed you can try to use a DB browser to see what tables are large and what content may be left in them.

If you end up going with another library.db rebuild after all this, a similar approach should be taken. Note the size when you started, which should be basically empty since it's "fresh", then add one library at a time and wait for it to completely finish scanning before adding another one, taking note of the size each time.

Posted
1 hour ago, Lessaj said:

I think it would be best to do in stages.

Take note of the current size, delete one library, check the size, repeat. May take some time to actually delete the content from the DB and may also be a good idea to run a library scan inbetween each deletion as well, so make sure to check the log file. This may help to narrow down a particular offender library, and also keeps the people in the DB so when everything is gone content wise there should be little that remains.

If it is still very large after everything has been removed you can try to use a DB browser to see what tables are large and what content may be left in them.

If you end up going with another library.db rebuild after all this, a similar approach should be taken. Note the size when you started, which should be basically empty since it's "fresh", then add one library at a time and wait for it to completely finish scanning before adding another one, taking note of the size each time.

I'm still going through each one now....but when i went to delete the "TV Shows" is hung quite a bit and i had to restart the server to fully remove it (it removed the path, but not the library)

Posted

Yes that's a big library with a lot of items, I would expect that to take a while. You may have interrupted it essentially but a scan library task might clean out any remaining paths.

Posted (edited)

When you were talking about my file naming scheme, could you explain more on that? Is it just the extra letter folders mostly?

Edited by Coolbule
Posted
1 hour ago, Lessaj said:

Yes that's a big library with a lot of items, I would expect that to take a while. You may have interrupted it essentially but a scan library task might clean out any remaining paths.

Alright with everything gone I still had 15GB left. I got into the DB Browser and here's my row counts for the tables left. Do you happen to know anything about fts_serach9_data or UserDataKeys2? Those seem to atleast be part of the problem

 

image.png.9e1b49930465f09689b81662c9bd8d1b.png

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...