I've seen the posts on the support of these plugins.

I was having a issue with restarts and rescans of my server taking 90
minutes to 2 hours on a 20k library with TrackStat enabled.

Today I decided to get to the bottom on it.  

The "refreshTracks" function in the Storage.pm module creates a temp
table to join the tracks and track_statistics table on the music brains
id.

There is no index on the musicbrainz_id column on the temp table.

Before:
> 
> QUERY PLAN
> |--SCAN TABLE track_statistics
> |--CORRELATED SCALAR SUBQUERY 3
> |  `--SCAN TABLE temp_track_statistics
> |--CORRELATED SCALAR SUBQUERY 1
> |  `--SCAN TABLE temp_track_statistics
> `--CORRELATED SCALAR SUBQUERY 2
> `--SCAN TABLE temp_track_statistics
> 

After adding an Index:

> 
> QUERY PLAN
> |--SCAN TABLE track_statistics
> |--CORRELATED SCALAR SUBQUERY 3
> |  `--SEARCH TABLE temp_track_statistics USING INDEX tts
> (musicbrainz_id=?)
> |--CORRELATED SCALAR SUBQUERY 1
> |  `--SEARCH TABLE temp_track_statistics USING INDEX tts
> (musicbrainz_id=?)
> `--CORRELATED SCALAR SUBQUERY 2
> `--SEARCH TABLE temp_track_statistics USING INDEX tts
> (musicbrainz_id=?)
> 

Before the index the UPDATE statement took over 6000 seconds...

> 
> Finished updating urls in statistic data based on musicbrainz ids,
> updated 222517 items : It took 3.073275 seconds
> 

Perl is not my first language, my code change is ugly, simple and likely
needs proper error handling.

I would be happy to share with anyone that is interested, but I dont
want to own the plugins :D



-MrD
===================
1 Transporter
2 Squeezeboxen v3
1 Squeezebox v1
1 SliMP3
Linux x86-64 SlimServer 6.5.1
------------------------------------------------------------------------
MrD's Profile: http://forums.slimdevices.com/member.php?userid=6099
View this thread: http://forums.slimdevices.com/showthread.php?t=49483

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to