Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Linux client startup very slow

Solved!

Linux client startup very slow

Plan

Premium (Family)

Country

Brazil

Device

Dell Inspiron 14 Series

Operating System

Linux Mint 19.3 Xfce

 

My Question or Issue

Unlike the startup on Windows client, on Linux it's very slow to startup the Spotify client. Sometimes it gets so slow that I prefer to open the browser and enter in YouTube Music while the Spotify client starts. I love Spotify, and I'm very happy with the fact that you have a Linux client, you're the best! But, with some issues to solve, that slow startup is one of them. Thanks a lot for your attention!

Reply

Accepted Solutions
Marked as solution

So : I poked around in the directory `~/.cache/spotify`

I have 11G of cached music in there but that doesn't seem to be the issue.
There's a database : `mercury.db`, this appears to be an mostly an index of all the cached data blocks and a few other things. This is a sqlite3 database.

I closed Spotify, opened the database thus

sqlite3 mercury.db

And did this at the sqlite3 console

VACUUM;

Then ctrl-D to exit.

My Spotify client started *much* faster this morning.

View solution in original post

9 Replies

Hey @pedro2012 

 

I can tell it's one of the slowest programs to open on my machine as well (other is Wine Foobar), but yours seems a bit extended. 🙂

Can you tell if it has been that slow all the time, or is it becoming slower on you?

 

Also, does anything change when you disable local files (if you have them enabled)?

 

Have a nice day!

Hello!

 

Thank you for your attention. I don't have the local files enabled, but that doesn't really change much. It's slow just to startup; once it's fully started it works perfectly well without any significant delay. If you want, I could make a video for demo.

 

Have a nice day too 🙂

@pedro2012 

 

A video would be nice! 🙂

 

I can tell my client also starts up rather slow (~3 seconds), and once it's running, there is no problem with any delays or anything. I do have a SSD in the machine, so I don't know how slow would it be on HDD.

 

Did you install Spotify with Snap?

Also, what distro are you running?

 

Looking forward to your reply 🙂

Marked as solution

So : I poked around in the directory `~/.cache/spotify`

I have 11G of cached music in there but that doesn't seem to be the issue.
There's a database : `mercury.db`, this appears to be an mostly an index of all the cached data blocks and a few other things. This is a sqlite3 database.

I closed Spotify, opened the database thus

sqlite3 mercury.db

And did this at the sqlite3 console

VACUUM;

Then ctrl-D to exit.

My Spotify client started *much* faster this morning.

WOW! That really worked like magic, thank you very much! As a enthusiastic of computer science I must ask: how did you do that? I did a quick research over the internet and I found this article https://www.sqlitetutorial.net/sqlite-vacuum/ with more detailed information about what this command does and it totally makes sense to me that you used this command specifically.

 

Best Regards!

This is a brilliant solution, and it could also help those on Windows/Mac too, as long as sqlite is installed.

Good job and thank you for this @dr_barnowl 🌟

> how did you do that?

 

It's not my first brush with sqlite databases ; they're also used for profile data in Firefox, and as the data/settings store in a lot of Android projects, and as "test" databases for a lot of projects (before you graduate to a grown-up database server). I think it Firefox offers to clean them up and vacuum every couple of major versions now, but there was an extension that did the vacuum for you a while back, and that's why I'm familiar with the term.

 

Lots of software takes the convention of naming them `*.db`, and even if they don't, Linux has great filetype detection tools ...

 

    ❯ file mercury.db
    mercury.db: SQLite 3.x database, last written using SQLite version 3016002

 

Or if you open it in a hex editor, the first few bytes say "SQLite format version 3".

 

I can't tell for sure, but the word "VACUUM" doesn't seem to appear anywhere in the Spotify client binary except from where it's statically linked as part of the SQLite libraries, so I don't know if it ever vacuums. But it doesn't seem like it. It deletes entries from the storage table as they drop out of your assigned cache space, so that will cause fragmentation.

Thanks for this solution! You can also run sqlite3 mercury.db 'VACUUM;' to avoid having to go into the console.

This is amazing. How many times must we vacuum the sqlite?

From minutes to <1sec of startup.

Suggested posts