Ticket #10023: 0007-Speed-up-and-reduce-temporary-space-of-time-search-a.patch

File 0007-Speed-up-and-reduce-temporary-space-of-time-search-a.patch, 3.3 KB (added by dekarl@…, 8 years ago)

updated patch to master/0.26 post UTC

  • mythtv/libs/libmyth/programinfo.cpp

    From a6a7bbed0954eec317b9fc8edb7f8bc2f3f18fd3 Mon Sep 17 00:00:00 2001
    From: Karl Dietz <dekarl@users.sourceforge.net>
    Date: Sun, 15 Jul 2012 14:44:10 +0200
    Subject: [PATCH 7/7] Speed up and reduce temporary space of time search a lot.
    
    By factoring out the description into a super query the performance can
    be greatly improved (e.g. from 2 minutes to 2 seconds)
    
    Thanks to sphery for inspiration by [d9fb21853f] and justinh for testing
    and fixing my braino with the column order.
    
    Closes #10023
    ---
     mythtv/libs/libmyth/programinfo.cpp |   20 +++++++++++---------
     1 files changed, 11 insertions(+), 9 deletions(-)
    
    diff --git a/mythtv/libs/libmyth/programinfo.cpp b/mythtv/libs/libmyth/programinfo.cpp
    index 3bf35ea..972b951 100644
    a b static bool FromProgramQuery( 
    45304530    const QString &sql, const MSqlBindings &bindings, MSqlQuery &query)
    45314531{
    45324532    QString querystr = QString(
     4533        "SELECT program.description, sub.* FROM program, ("
    45334534        "SELECT DISTINCT program.chanid, program.starttime, program.endtime, "
    4534         "    program.title, program.subtitle, program.description, "
     4535        "    program.title, program.subtitle, "
    45354536        "    program.category, channel.channum, channel.callsign, "
    45364537        "    channel.name, program.previouslyshown, channel.commmethod, "
    45374538        "    channel.outputfilters, program.seriesid, program.programid, "
    static bool FromProgramQuery( 
    45654566    if (!sql.contains(" LIMIT "))
    45664567        querystr += " LIMIT 20000 ";
    45674568
     4569    querystr += " ) AS sub WHERE program.chanid=sub.chanid AND program.starttime=sub.starttime";
    45684570    query.prepare(querystr);
    45694571    MSqlBindings::const_iterator it;
    45704572    for (it = bindings.begin(); it != bindings.end(); ++it)
    bool LoadFromProgram( 
    45974599    {
    45984600        destination.push_back(
    45994601            new ProgramInfo(
    4600                 query.value(3).toString(), // title
    4601                 query.value(4).toString(), // subtitle
    4602                 query.value(5).toString(), // description
     4602                query.value(4).toString(), // title
     4603                query.value(5).toString(), // subtitle
     4604                query.value(0).toString(), // description
    46034605                query.value(6).toString(), // category
    46044606
    4605                 query.value(0).toUInt(), // chanid
     4607                query.value(1).toUInt(), // chanid
    46064608                query.value(7).toString(), // channum
    46074609                query.value(8).toString(), // chansign
    46084610                query.value(9).toString(), // channame
    46094611                query.value(12).toString(), // chanplaybackfilters
    46104612
    4611                 MythDate::as_utc(query.value(1).toDateTime()), // startts
    4612                 MythDate::as_utc(query.value(2).toDateTime()), // endts
    4613                 MythDate::as_utc(query.value(1).toDateTime()), // recstartts
    4614                 MythDate::as_utc(query.value(2).toDateTime()), // recendts
     4613                MythDate::as_utc(query.value(2).toDateTime()), // startts
     4614                MythDate::as_utc(query.value(3).toDateTime()), // endts
     4615                MythDate::as_utc(query.value(2).toDateTime()), // recstartts
     4616                MythDate::as_utc(query.value(3).toDateTime()), // recendts
    46154617
    46164618                query.value(13).toString(), // seriesid
    46174619                query.value(14).toString(), // programid