Ticket #12451: 0001-add-daily-defragmentation-of-the-recordedseek-table.patch

File 0001-add-daily-defragmentation-of-the-recordedseek-table.patch, 1.4 KB (added by Karl Egly, 5 years ago)
  • mythtv/programs/mythbackend/backendhousekeeper.cpp

    From 3ac04ec290fbaf975c49095e905f42d7841d5a20 Mon Sep 17 00:00:00 2001
    From: Karl Dietz <dekarl@mythtv.org>
    Date: Fri, 29 May 2015 15:32:20 +0200
    Subject: [PATCH] add daily defragmentation of the recordedseek table
    
    This fixed very slow (more then 10 seconds) waiting times on start of
    recording playback caused by very slow loading of the seek table from
    the database.
    
    Fixes #12451
    ---
     mythtv/programs/mythbackend/backendhousekeeper.cpp | 11 +++++++++++
     1 file changed, 11 insertions(+)
    
    diff --git a/mythtv/programs/mythbackend/backendhousekeeper.cpp b/mythtv/programs/mythbackend/backendhousekeeper.cpp
    index 7e0da83..d421476 100644
    a b void CleanupTask::CleanupRecordedTables(void) 
    271271    }
    272272
    273273    if (!query.exec("DROP TABLE temprecordedcleanup;"))
     274    {
    274275        MythDB::DBError("CleanupTask::CleanupRecordedTables"
    275276                                "(deleting temporary table)", query);
     277        return;
     278    }
     279
     280    query.prepare(QString("ALTER TABLE recordedseek ORDER BY chanid, starttime;"));
     281    if (!query.exec() || !query.isActive())
     282    {
     283        MythDB::DBError("CleanupTask::CleanupRecordedTables"
     284                              "(defragmenting recorded seek table)", query);
     285        return;
     286    }
    276287}
    277288
    278289void CleanupTask::CleanupProgramListings(void)