Bugzilla – Attachment 22930 Details for
Bug 11249
Add db indexes on borrowers names
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11249 - Add db indexes on borrowers names
0001-Bug-11249-Add-db-indexes-on-borrowers-names.patch (text/plain), 2.84 KB, created by
Fridolin Somers
on 2013-11-14 13:33:44 UTC
(
hide
)
Description:
Bug 11249 - Add db indexes on borrowers names
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2013-11-14 13:33:44 UTC
Size:
2.84 KB
patch
obsolete
>From 84a2a3e6e746813af784b443a1406b6ad9b171fa Mon Sep 17 00:00:00 2001 >From: Fridolyn SOMERS <fridolyn.somers@biblibre.com> >Date: Thu, 14 Nov 2013 14:29:51 +0100 >Subject: [PATCH] Bug 11249 - Add db indexes on borrowers names > >The borrowers search is by default on columns surname, firstname, othernames and cardnumber. >(See C4::Members::_express_member_find). >Addind db indexes will really increase the query speed. > >This patch adds bd indexes on surname, firstname, othernames (cardnumber has already an index). >Those indexes must be defined with a size because columns are mediumtext. > >Test plan : >Test with mysql client : >mysql> explain select * from borrowers where surname like 'A%'; >+----+-------------+-----------+-------+---------------+---------+---------+------+------+-------------+ >| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | >+----+-------------+-----------+-------+---------------+---------+---------+------+------+-------------+ >| 1 | SIMPLE | borrowers | range | surname | surname | 767 | NULL | 395 | Using where | >+----+-------------+-----------+-------+---------------+---------+---------+------+------+-------------+ >1 row in set (0.00 sec) >=> key show the index is used >--- > installer/data/mysql/kohastructure.sql | 3 +++ > installer/data/mysql/updatedatabase.pl | 12 ++++++++++++ > 2 files changed, 15 insertions(+) > >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index fefc985..20d3de9 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -271,6 +271,9 @@ CREATE TABLE `borrowers` ( -- this table includes information about your patrons > KEY `branchcode` (`branchcode`), > KEY `userid` (`userid`), > KEY `guarantorid` (`guarantorid`), >+ KEY `surname` (`surname`(255)), >+ KEY `firstname` (`firstname`(255)), >+ KEY `othernames` (`othernames`(255)), > CONSTRAINT `borrowers_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`), > CONSTRAINT `borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8; >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 6162bc5..d97a3fd 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -7743,6 +7743,18 @@ if(CheckVersion($DBversion)) { > SetVersion($DBversion); > } > >+$DBversion = "3.13.00.XXX"; >+if(CheckVersion($DBversion)) { >+ $dbh->do(q{ >+ ALTER TABLE `borrowers` >+ ADD KEY `surname` (`surname`(255)), >+ ADD KEY `firstname` (`firstname`(255)), >+ ADD KEY `othernames` (`othernames`(255)) >+ }); >+ print "Upgrade to $DBversion done (Koha 3.14 beta)\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >-- >1.8.3.2 >
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 11249
:
22930
|
23001
|
23223
|
23262
|
74372