Opened 9 years ago
Closed 9 years ago
Last modified 9 years ago
#8819 closed patch (fixed)
Scheduler Optimization
Reported by: | Rob Smith | Owned by: | gigem |
---|---|---|---|
Priority: | trivial | Milestone: | 0.24 |
Component: | MythTV - Scheduling | Version: | Master Head |
Severity: | low | Keywords: | |
Cc: | Ticket locked: | no |
Description
SELECT DISTINCT is pretty inefficient compared to GROUP BY, so this patch switches a DISTINCT for a GROUP BY and should be functionally equivalent. Wanted to run it by you before committing.
Attachments (1)
Change History (5)
Changed 9 years ago by
Attachment: | SchedulerDistinct.patch added |
---|
comment:1 Changed 9 years ago by
comment:2 Changed 9 years ago by
After rechecking the BUQ, I think the GROUP BY fields would need to be recordid, chanid, starttime, manualid and cardinputid. However, I'm now pretty sure that previous tweaking of the BUQ made the DISTINCT (and GROUP BY) superfluous. IOW, I think the DISTINCT can simply be removed.
Good catch, kormoc, although, the speedup I see is negligible at best.
comment:3 Changed 9 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:4 Changed 9 years ago by
Milestone: | unknown → 0.24 |
---|
Note: See
TracTickets for help on using
tickets.
I believe this patch has a very high degree of causing subtle breakage in the scheduler. The scheduler has used SELECT DISTINCT since before I started mucking with it and is full of assumptions that every returned row is unique. The only way to safely switch to GROUP BY is to thoroughly check the usage of every column returned in the query. At a minimum, recordid, manualid and probably oldrecduplicate, recduplicate and findduplicate would need to be included in any GROUP BY clause.