[Koha-patches] [PATCH] Bug 4139 - Adding some indexes to deal with a performance issue with overdue reports

Chris Cormack chris at bigballofwax.co.nz
Tue Jul 6 10:58:03 CEST 2010


---
 installer/data/mysql/kohastructure.sql |    6 ++++--
 installer/data/mysql/updatedatabase.pl |    8 ++++++++
 kohaversion.pl                         |    2 +-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index d8ed27d..e42cecd 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -104,7 +104,8 @@ CREATE TABLE `authorised_values` (
   `imageurl` varchar(200) default NULL,
   PRIMARY KEY  (`id`),
   KEY `name` (`category`),
-  KEY `lib` (`lib`)
+  KEY `lib` (`lib`),
+  KEY `auth_value_idx` (`authorised_value`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
 --
@@ -279,7 +280,8 @@ CREATE TABLE `borrower_attribute_types` (
   `password_allowed` tinyint(1) NOT NULL default 0,
   `staff_searchable` tinyint(1) NOT NULL default 0,
   `authorised_value_category` varchar(10) default NULL,
-  PRIMARY KEY  (`code`)
+  PRIMARY KEY  (`code`),
+  KEY `auth_val_cat_idx` (`authorised_value_category`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
 --
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index f32d43c..4210328 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -3677,6 +3677,14 @@ if (C4::Context->preference('Version') < TransformToNum($DBversion)){
     SetVersion ($DBversion);
 }
 
+$DBversion = 'XXXX';
+if (C4::Context->preference('Version') < TransformToNum($DBversion)){
+    $dbh->do(qq{CREATE INDEX auth_value_idx ON authorised_values (authorised_value)});
+    $dbh->do(qq{CREATE INDEX auth_val_cat_idx ON borrower_attribute_types (authorised_value_category)});
+    print "Create index on authorised_values and borrower_attribute_types (bug 4139)";
+    SetVersion ($DBversion);
+}
+
 
 =item DropAllForeignKeys($table)
 
diff --git a/kohaversion.pl b/kohaversion.pl
index d2cf8db..04bf493 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -11,7 +11,7 @@ use strict;
 
 sub kohaversion {
 
-    our $VERSION = '3.01.00.142';
+    our $VERSION = 'XXXX';
 
     # version needs to be set this way
     # so that it can be picked up by Makefile.PL
-- 
1.6.3.3



More information about the Koha-patches mailing list