[mythtv-commits] Ticket #10447: Program Listing SQL Optimization

MythTV noreply at mythtv.org
Tue Mar 13 20:04:34 UTC 2012


#10447: Program Listing SQL Optimization
-------------------------------+----------------------------------
 Reporter:  fracmak@…          |           Type:  Developer Task
   Status:  new                |       Priority:  minor
Milestone:  unknown            |      Component:  MythTV - General
  Version:  Master Head        |       Severity:  low
 Keywords:                     |  Ticket locked:  0
-------------------------------+----------------------------------
 I've been playing with this change on my local mythweb with enormous (2 to
 3x) performance improvements (Ticket #10047). Currently, when a query is
 made on the program listing table, the best suited index is as follows:

 id_start_end (chanid, starttime, endtime)

 but if the chanid range gets to be too large, the server could pick a
 different query. Sometimes it'll use the PRIMARY(chanid, starttime,
 manualid) or starttime(starttime) indexes. None of these though take into
 account endtime.

 Because of the fact we only use starttime < endtime as a limit on the
 starttime field, means a large number of unnecessary entries need to be
 loaded to check the endtime. This becomes incredibly apparent when you try
 and load more than 70 channels on my system, at which point the
 performance gets significantly worse.

 To get around this, I put a max cap on the starttime entry, since this is
 the field most likely to be used in the index. According to my own
 calculations, no program lasts longer than 12 hours on my system, but I
 made the query cap 24 hours just to be safe.

 Adding this cap has resulted in a substantial jump in performance.

-- 
Ticket URL: <http://code.mythtv.org/trac/ticket/10447>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center


More information about the mythtv-commits mailing list