Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix inefficiency in marking first/last showings without programids.
For users without programids (where listings provider doesn't specify a programid and doesn't specify both season and episode number), mythfilldatabase marks first/last showings by comparing title, subtitle, and description to find unique episodes. If the listings provider provides extremely long descriptions (>>255 characters), this results in mysqld creating on-disk temp tables, and can create extremely long run times for this specific query (with one user reporting times on the order of 30min using an AMD Athlon II 5050e with 2GB RAM). This change limits the query to use only the first 1024 characters of description for the SELECT and the GROUP BY. This is equivalent to what we were doing before ccb759a changed the description from TEXT to VARCHAR, since MySQL automatically uses max_sort_length (defaults to 1024) for sorting text and blob fields (including GROUP BY). Even in the event of 2 shows that differ only after the first 1024 characters of the description, but that air at the same time, the logic is sound. In the event 2 shows with different start times that differ only after the first 1024 characters of the description exist in the listings, one won't be properly marked as first/last showing, but I'd hope that listings providers would provide some indication of differences before the end of the novel (but, again, this is the same behavior we would have seen before the change to use VARCHAR for description). Thanks to Jan Schneider for noticing the issue and performing a bunch of test queries to help me find a way to work around it. (cherry picked from commit 8b0daaf)
- Loading branch information