From 8acb5adf90cbe41c3de1c3084752aa70fbf52308 Mon Sep 17 00:00:00 2001 From: Karl Dietz Date: Sun, 21 Jul 2013 23:50:55 +0200 Subject: [PATCH] add index to improve mythfilldatabase performance fix index documentation of related index while here slipping it in before the beta is cut as per discussion at http://irc.mythtv.org/ircLog/channel/4/2013-08-15:19:25 Fixes #11282 --- mythtv/bindings/perl/MythTV.pm | 2 +- mythtv/bindings/python/MythTV/static.py | 2 +- mythtv/libs/libmythbase/mythversion.h | 2 +- mythtv/libs/libmythtv/dbcheck.cpp | 17 +++++++++++++++-- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/mythtv/bindings/perl/MythTV.pm b/mythtv/bindings/perl/MythTV.pm index 5b68b074e3a..1b63a3a67bb 100644 --- a/mythtv/bindings/perl/MythTV.pm +++ b/mythtv/bindings/perl/MythTV.pm @@ -115,7 +115,7 @@ package MythTV; # schema version supported in the main code. We need to check that the schema # version in the database is as expected by the bindings, which are expected # to be kept in sync with the main code. - our $SCHEMA_VERSION = "1315"; + our $SCHEMA_VERSION = "1316"; # NUMPROGRAMLINES is defined in mythtv/libs/libmythtv/programinfo.h and is # the number of items in a ProgramInfo QStringList group used by diff --git a/mythtv/bindings/python/MythTV/static.py b/mythtv/bindings/python/MythTV/static.py index 886d7fba9e4..a6840d2f66e 100644 --- a/mythtv/bindings/python/MythTV/static.py +++ b/mythtv/bindings/python/MythTV/static.py @@ -5,7 +5,7 @@ """ OWN_VERSION = (0,27,-1,0) -SCHEMA_VERSION = 1315 +SCHEMA_VERSION = 1316 NVSCHEMA_VERSION = 1007 MUSICSCHEMA_VERSION = 1018 PROTO_VERSION = '77' diff --git a/mythtv/libs/libmythbase/mythversion.h b/mythtv/libs/libmythbase/mythversion.h index 41be7f993b7..181675bea4a 100644 --- a/mythtv/libs/libmythbase/mythversion.h +++ b/mythtv/libs/libmythbase/mythversion.h @@ -61,7 +61,7 @@ * mythtv/bindings/php/MythBackend.php #endif -#define MYTH_DATABASE_VERSION "1315" +#define MYTH_DATABASE_VERSION "1316" MBASE_PUBLIC const char *GetMythSourceVersion(); diff --git a/mythtv/libs/libmythtv/dbcheck.cpp b/mythtv/libs/libmythtv/dbcheck.cpp index 0d68f7f653d..1a112c6a771 100644 --- a/mythtv/libs/libmythtv/dbcheck.cpp +++ b/mythtv/libs/libmythtv/dbcheck.cpp @@ -63,8 +63,9 @@ The schema contains the following tables: people pk(person) uk(name) pidcache profilegroups pk(id) uk(name,hostname) -program k(endtime) k(title) k(title_pronounce) k(seriesid) - k(programid) k(chanid,starttime,endtime) +program k(endtime) k(title_pronounce) k(seriesid) + k(programid,starttime) k(chanid,starttime,endtime) + k(title,subtitle,starttime) programgenres pk(chanid,starttime,relevance) programrating uk(chanid,starttime,system,rating) k(starttime,system) @@ -2450,6 +2451,18 @@ NULL return false; } + if (dbver == "1315") + { + const char *updates[] = { +"ALTER TABLE program ADD INDEX title_subtitle_start (title, subtitle, starttime);", +"ALTER TABLE program DROP INDEX title;", +NULL +}; + if (!performActualUpdate(updates, "1316", dbver)) + return false; + } + + return true; }