Opened 11 years ago

Closed 11 years ago

Last modified 11 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


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)

SchedulerDistinct.patch (983 bytes) - added by Rob Smith 11 years ago.

Download all attachments as: .zip

Change History (5)

Changed 11 years ago by Rob Smith

Attachment: SchedulerDistinct.patch added

comment:1 Changed 11 years ago by gigem

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.

comment:2 Changed 11 years ago by gigem

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 11 years ago by gigem

Resolution: fixed
Status: newclosed

(In [25836]) Removed "DISTINC" from the BUQ in the scheduler. It was made superfluous by previous restructuring of the query. Based on a patch from kormoc. Fixes #8819.

comment:4 Changed 11 years ago by stuartm

Milestone: unknown0.24
Note: See TracTickets for help on using tickets.