[Koha-patches] [PATCH] bug 2859: add index on bibioitems.issn (DB rev 006)
Galen Charlton
galen.charlton at liblime.com
Thu Dec 11 18:59:55 CET 2008
Because of a query on biblioitems.issn in
C4::Breeding::ImportBreeding(), libraries doing a lot
of bib imports were experiencing performance problems,
which adding an index will alleviate.
A possible longer term solution is to index all
reservoir/import batch records in a Zebra database.
[LL bug 232]
---
installer/data/mysql/kohastructure.sql | 1 +
installer/data/mysql/updatedatabase.pl | 7 +++++++
kohaversion.pl | 2 +-
3 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index fa93a05..b2e7515 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -420,6 +420,7 @@ CREATE TABLE `biblioitems` (
KEY `bibnoidx` (`biblionumber`),
KEY `isbn` (`isbn`),
KEY `publishercode` (`publishercode`),
+ KEY `issn` (`issn`),
CONSTRAINT `biblioitems_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 6c14e97..fdebcf9 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -2060,6 +2060,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
SetVersion ($DBversion);
}
+$DBversion = '3.01.00.006';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("ALTER TABLE `biblioitems` ADD KEY issn (issn)");
+ print "Upgrade to $DBversion done (add index on biblioitems.issn)\n";
+ SetVersion ($DBversion);
+}
+
=item DropAllForeignKeys($table)
Drop all foreign keys of the table $table
diff --git a/kohaversion.pl b/kohaversion.pl
index a6eaa26..12d23eb 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -10,7 +10,7 @@
use strict;
sub kohaversion {
- our $VERSION = '3.01.00.005';
+ our $VERSION = '3.01.00.006';
# version needs to be set this way
# so that it can be picked up by Makefile.PL
# during install
--
1.5.5.GIT
More information about the Koha-patches
mailing list