From f320582b2f0a13a1a604d353300cea3238ef72cd Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Thu, 25 Aug 2011 15:21:01 +1200 Subject: [PATCH] Bug 5866 : Updated patch to speed up holds awaiting pickup This reduced execution time on the report from timeout (1400 holds waiting + 200 holds over) to 6 or so seconds, with 1566 holds over (test data, no holds waiting). Signed-off-by: Liz Rea Signed-off-by: Ian Walls --- circ/waitingreserves.pl | 3 +-- installer/data/mysql/kohastructure.sql | 1 + installer/data/mysql/updatedatabase.pl | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/circ/waitingreserves.pl b/circ/waitingreserves.pl index 9850114a24..c2f868d0fa 100755 --- a/circ/waitingreserves.pl +++ b/circ/waitingreserves.pl @@ -111,10 +111,9 @@ foreach my $num (@getreserves) { my $gettitle = GetBiblioFromItemNumber( $num->{'itemnumber'} ); # fix up item type for display $gettitle->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $gettitle->{'itype'} : $gettitle->{'itemtype'}; - my $getborrower = GetMemberDetails( $num->{'borrowernumber'} ); + my $getborrower = GetMember(borrowernumber => $num->{'borrowernumber'}); my $itemtypeinfo = getitemtypeinfo( $gettitle->{'itemtype'} ); # using the fixed up itype/itemtype $getreserv{'waitingdate'} = format_date( $num->{'waitingdate'} ); - my ( $waiting_year, $waiting_month, $waiting_day ) = split (/-/, $num->{'waitingdate'}); ( $waiting_year, $waiting_month, $waiting_day ) = Add_Delta_Days( $waiting_year, $waiting_month, $waiting_day, diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 8b8401912a..13fa53dd03 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1555,6 +1555,7 @@ CREATE TABLE `reserves` ( `waitingdate` date default NULL, `expirationdate` DATE DEFAULT NULL, `lowestPriority` tinyint(1) NOT NULL, + KEY priorityfoundidx (priority,found), KEY `borrowernumber` (`borrowernumber`), KEY `biblionumber` (`biblionumber`), KEY `itemnumber` (`itemnumber`), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 030897c67f..1085db9cb8 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4432,6 +4432,14 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.05.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("CREATE INDEX priorityfoundidx ON reserves (priority,found)"); + print "Create an index on reserves to speed up holds awaiting pickup report bug 5866\n"; + SetVersion($DBversion); +} + + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) -- 2.39.5