Bug 4139 - Adding some indexes to deal with a performance issue with overdue reports
authorChris Cormack <chris@bigballofwax.co.nz>
Tue, 6 Jul 2010 08:58:03 +0000 (20:58 +1200)
committerGalen Charlton <gmcharlt@gmail.com>
Tue, 6 Jul 2010 12:23:35 +0000 (08:23 -0400)
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
installer/data/mysql/kohastructure.sql
installer/data/mysql/updatedatabase.pl
kohaversion.pl

index d8ed27d..e42cecd 100644 (file)
@@ -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;
 
 --
index f32d43c..4210328 100755 (executable)
@@ -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)
 
index d2cf8db..04bf493 100644 (file)
@@ -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