This above is only used for MySQL and I don't think LMS supports MySQL these days, so you can probably ignore that.
If you like to go the quick and dirty route and just optimise these SQL statements a bit I wonder if there needs to be some indexes created for the temp table. For the permanent track_statistics table I create a number of indexes here in the code: https://github.com/erland/lms-tracks...torage.pm#L365
Could be that these indexes aren't transfered automatically to the temp table and in that case that could maybe be the issue. However, it is a bit strange because looking at the SQL I would expect the temp table to be empty unless you have renamed/moved music files. I wonder if you have multiple tracks with the same musicbrainz id in your database, because that would probably cause the temp table to contain some data. Multiple tracks with same musicbrainz id is known to result in data in track_statistics table to become incorrectly duplicated, so I've suggested to people who have these kind of duplicates in their library to disable musicbrainz support in TrackStat.
Results 11 to 20 of 47
-
2021-02-26, 05:31 #11Erland Isaksson (My homepage)
Developer of many plugins/applets
Starting with LMS 8.0 I no longer support my plugins/applets (see here for more information )
-
2021-02-26, 05:35 #12
The SQL statement in the refresh operation still executes but isn't supposed to do anything.However, as mentioned in my post a few seconds ago, I would expect the temp table to be empty in your case. However, if you have multiple tracks with same musicbrainz id that could explain it, because then the temp table would not be empty and it would likely cause a lot of duplicates in the track_statistics table.
You could run the select that creates the temp table and see if it returns something towards your database. If you aren't able to connect directly towards the database you can use Database Query plugin and create a free form query to run the select statement.Erland Isaksson (My homepage)
Developer of many plugins/applets
Starting with LMS 8.0 I no longer support my plugins/applets (see here for more information )
-
2021-02-26, 06:25 #13
- Join Date
- Mar 2011
- Posts
- 164
Last edited by mamema; 2021-02-26 at 06:36.
-
2021-02-26, 06:40 #14
Working on a plugin - Scanning question
> the involved sql queries are:
Time each of these queries to figure out which one burns the most CPU cycle.
my $t = time();
runSQL1(); # whatever
warn "SQL1: " . (time() - $t);
Or similar. Poor man's instrumentation.
If you want to go fancy, you can look into installing NYTProf and
profile the runs (https://metacpan.org/pod/Devel::NYTProf). This will
further slow down the process and take additional time to generate
useful reports. You might want to try with a smaller collection first.
-
2021-02-26, 07:40 #15
Working on a plugin - Scanning question
>> the involved sql queries are:
>
> Time each of these queries to figure out which one burns the most CPU
> cycle.
>
> my $t = time();
> runSQL1(); # whatever
> warn "SQL1: " . (time() - $t);
>
> Or similar. Poor man's instrumentation.
Oh, just saw that Erland did add a lot of timing measurements already.
Run LMS with debug mode for plugin.trackstat, then provide the
server.log file.
-
2021-02-26, 07:50 #16
Working on a plugin - Scanning question
> Part 3: Analyze command
> https://github.com/erland/lms-tracks...orage.pm#L1406
> - Run analyze command to optimise the performance of TrackStat table
> - Not sure analyse is possible to run on per track basis so this should
> probably run as a post scan action. Don't think it's needed at LMS
> startup.
Analayze should certainly be run, but only once, at the end of a scan -
which LMS already does.
> Part 8: Update ratings in LMS database
> https://github.com/erland/lms-tracks...orage.pm#L1496
> - The purpose of this part is to update ratings in LMS tracks_persistent
> table with the value from TrackStat table.
So are you saying that you keep a separate database file around, then
duplicate the data to the persist database? That certainly would be one
good place to optimize...
> - Not really sure this is required any more, might be there for
> historical reason when tracks_persistent didn't always survived upgrades
Yep.
-
2021-02-26, 08:05 #17
- Join Date
- Mar 2011
- Posts
- 164
at the moment looking around to find some sqlite query tools which are able to execute those queries. A little bit difficult because those tools (DBeaver for example) are executing against ONE db file and i have to use the persistent.db and library.db
and Michael by the way, i've enabled debug level and the snippet about the 3.5 hours (above in thread) is the only time related message from trackstat
-
2021-02-26, 08:18 #18
If you want to run a SELECT statement it’s probably easiest to do that by creating a Free form query in Database Query plugin. By doing that you don’t have to care if the tables are in persist or library db.
That’s for the musicbrainz part, do you have the log entries for the other parts of the refresh operation also.Erland Isaksson (My homepage)
Developer of many plugins/applets
Starting with LMS 8.0 I no longer support my plugins/applets (see here for more information )
-
2021-02-26, 08:18 #19
I'm using SQLiteStudio (https://sqlitestudio.pl). It allows you to "attach" additional files:
Wouldn't there be more information, like what step took how long?Michael
"It doesn't work - what shall I do?" - "Please check your server.log and/or scanner.log file!"
(LMS: Settings/Information)
-
2021-02-26, 08:45 #20
Separate table in persist.db. So it’s the same database file but separate table.
Not sure it’s possible to avoid a separate table as long as LMS deletes the data in track_persistent it you rename or move a music file. Part 1 in my description takes care of recovering the old rating, play count and last played time by using musicbrainz id but that’s only possible if the old data hasn’t been deleted when this logic executes.Erland Isaksson (My homepage)
Developer of many plugins/applets
Starting with LMS 8.0 I no longer support my plugins/applets (see here for more information )