[mythtv] Long scheduler runs

David Engel david at istwok.net
Thu Feb 7 16:09:52 UTC 2008


On Thu, Feb 07, 2008 at 09:11:05AM +0000, Allan Stirling wrote:
> Mark Buechler wrote:
> >> # Query_time: 11  Lock_time: 0  Rows_sent: 0  Rows_examined: 0
> >> DELETE FROM program WHERE manualid = -1 OR  (manualid <> 0 AND -1 = -1);
> 
> Since manualID is unsigned, this does not make any sense to me?
> 
> It is also the reason MySQL doesn't use the index - If you run:

Please try this patch and let me know how much of a difference it
makes for you all.  It only changes my schedule times by 0.16s.

David
-- 
David Engel
david at istwok.net


Index: programs/mythbackend/scheduler.cpp
===================================================================
--- programs/mythbackend/scheduler.cpp	(revision 15814)
+++ programs/mythbackend/scheduler.cpp	(working copy)
@@ -2319,10 +2319,13 @@
         return;
     }
 
-    query.prepare("DELETE FROM program "
-                  "WHERE manualid = :RECORDID OR "
-                  " (manualid <> 0 AND :RECORDID = -1)");
-    query.bindValue(":RECORDID", recordid);
+    if (recordid == -1)
+        query.prepare("DELETE FROM program WHERE manualid <> 0");
+    else
+    {
+        query.prepare("DELETE FROM program WHERE manualid = :RECORDID");
+        query.bindValue(":RECORDID", recordid);
+    }
     query.exec();
     if (!query.isActive())
     {


More information about the mythtv-dev mailing list