It is slow to delete cached offline files

Logs:

Upload description: Bithoarder

Additional information:

 
Peeking at the uploade log, it looks like it’s database queries that are taking most of the time, one of the extremes are:

Error/QueryBuilder: Query: SELECT provider_id, SUM(DISTINCT offline_status + 1) - 1, COALESCE(genres,“”) FROM songs GROUP BY provider_id, genres (‘’) [82136 in 719.31ms (RAW/false)]

I wonder if my database is either corrupted, or it is lacking some indices, or if I have an unusual use-case that is not covered by the normal indices.

 

Reproduction steps:

 
It is slow to delete cached offline files, it takes 2-3 seconds per file.
 

Media provider:

Subsonic

Screenshots:

     

This is expected there’s many things to update tied to offline data.

You can try Advanced settings / Cleanup internal state that may help a little.