Author Topic: Optimising Logitechmediaserver database  (Read 3391 times)

Offline Rotten Johnny

  • ROON's an empty promise
  • Administrator
  • Trade Count: (+31)
  • *****
  • Posts: 15,663
Optimising Logitechmediaserver database
« on: December 15, 2012, 08:38:49 AM »
If you've a large library and you're constantly adding new music to your Squeezebox, improving artwork, adding tags and moving or deleting albums you may find that over time LMS is not quite as snappy as you'd like it.  The underlying reason is that the database becomes fragmented as records relating to deleted/ moved albums etc. are set aside for new additions rather than being purged. To speed things up all you need do is stop LMS, load artwork.db, library.db and persist.db in sqlite's command line interpreter and issue a vacuum command for each.  This results in the database file being packed with deleted records etc. being omitted.  When you're done restart LMS and you should see snappy performance again.

Here's how I do it in Ubuntu server (assumes you're already in the correct folder where the db files are housed):
Code: [Select]
sudo service logitechmediaserver stop        ## stop LMS
sudo chown root:root *.db                    ## change ownership of the database files to root
sudo sqlite3 artwork.db                      ## open the db file using the sqlite interpreter then issue the vacuum command and hit ctrl-d when it's done to be returned to the command prompt
sudo chown logitechmediaserver:nogroup *.db  ## revert ownership of the db files to the logitechmediaserver user
sudo service logitechmediaserver start       ## restart LMS

Issuing the vacuum command in sqlite is simply a matter of typing
Code: [Select]
vacuum;hit ctrl-d when it's done to be returned to the command prompt
I like beautiful melodies telling me terrible things -- Tom Waits

Free your mind...and your ass will follow.

Offline GECO

  • Commercial Member
  • Trade Count: (+7)
  • *****
  • Posts: 7,901
Re: Optimising Logitechmediaserver database
« Reply #1 on: December 15, 2012, 08:55:34 AM »
Sticky please

Offline I Shot Tupac!!!

  • Trade Count: (+6)
  • AVForums Grandmaster
  • *****
  • Posts: 4,955
Re: Optimising Logitechmediaserver database
« Reply #2 on: December 15, 2012, 10:04:09 AM »
 :notworthy: :notworthy:

Offline lrossouw

  • Trade Count: (0)
  • AVForums Junior Member
  • *
  • Posts: 22
Re: Optimising Logitechmediaserver database
« Reply #3 on: February 08, 2013, 12:39:33 PM »
Does this speed things up significantly?
2x SqueezeBox Touch
1x SqueezeBox Classic
XBMC (soon to be on RPi)
Ubuntu Server (Video & Music)

Offline Rotten Johnny

  • ROON's an empty promise
  • Administrator
  • Trade Count: (+31)
  • *****
  • Posts: 15,663
Re: Optimising Logitechmediaserver database
« Reply #4 on: February 08, 2013, 12:45:56 PM »
Ye, if your db is fragmented. UI is snappier and scanning time noticeably reduced.
I like beautiful melodies telling me terrible things -- Tom Waits

Free your mind...and your ass will follow.

Offline scrarfussi

  • Trade Count: (+23)
  • AVForums Grandmaster
  • *****
  • Posts: 5,967
  • Quantum In Me Fuit
Re: Optimising Logitechmediaserver database
« Reply #5 on: August 07, 2014, 06:58:23 PM »
think we need a update on this for arch Johnny  :whip:
suum cuique pulchrum est


"Then Said my heart here will i take my rest."

Offline Rotten Johnny

  • ROON's an empty promise
  • Administrator
  • Trade Count: (+31)
  • *****
  • Posts: 15,663
Re: Optimising Logitechmediaserver database
« Reply #6 on: August 07, 2014, 07:09:47 PM »
The only difference for SoA is a different command set to stop and restart LMS and of course a different location for the cache folder.
I like beautiful melodies telling me terrible things -- Tom Waits

Free your mind...and your ass will follow.