Bugzilla – Attachment 8976 Details for
Bug 7886
C4/ShelfBrowser slow SQL performance
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7886 - C4/ShelfBrowser slow SQL performance
Bug-7886---C4ShelfBrowser-slow-SQL-performance.patch (text/plain), 2.31 KB, created by
Dobrica Pavlinusic
on 2012-04-06 17:10:14 UTC
(
hide
)
Description:
Bug 7886 - C4/ShelfBrowser slow SQL performance
Filename:
MIME Type:
Creator:
Dobrica Pavlinusic
Created:
2012-04-06 17:10:14 UTC
Size:
2.31 KB
patch
obsolete
>From 05e18c26a235c6e8e375bfc11e8185b7a9aa4813 Mon Sep 17 00:00:00 2001 >From: Dobrica Pavlinusic <dpavlin@rot13.org> >Date: Thu, 5 Apr 2012 01:03:30 +0200 >Subject: [PATCH] Bug 7886 - C4/ShelfBrowser slow SQL performance > >ShelfBrowser uses two SQL queries with syntax > >WHERE ((cn_sort = ? AND itemnumber < ?) OR cn_sort < ?) >AND homebranch = ? AND location = ? AND ccode = ? > >homebranch already has index, and adding indexes on ccode and location >improves performance by 30% for each query since MySQL is able to use >index_merge intersect(items_ccode,homebranch,items_location) >--- > installer/data/mysql/kohastructure.sql | 2 ++ > installer/data/mysql/updatedatabase.pl | 8 ++++++++ > 2 files changed, 10 insertions(+), 0 deletions(-) > >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 03911fe..21c657d 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1054,6 +1054,8 @@ CREATE TABLE `items` ( -- holdings/item information > KEY `homebranch` (`homebranch`), > KEY `holdingbranch` (`holdingbranch`), > KEY `itemcallnumber` (`itemcallnumber`), >+ KEY `items_location` (`location`), >+ KEY `items_ccode` (`ccode`), > CONSTRAINT `items_ibfk_1` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE, > CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE, > CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index b3c5691..fae6351 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -5159,6 +5159,14 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "3.07.00.XXX"; >+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { >+ $dbh->do("CREATE INDEX items_location ON items(location)"); >+ $dbh->do("CREATE INDEX items_ccode ON items(ccode)"); >+ print "Upgrade to $DBversion done (items_location and items_ccode indexes added for ShelfBrowser)"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 DropAllForeignKeys($table) >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7886
:
8895
| 8976