[Koha-bugs] [Bug 29134] Patron search has poor performance when ExtendedAttributes enabled and many attributes match

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Sep 29 14:33:20 CEST 2021


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29134

--- Comment #1 from Nick Clemens <nick at bywatersolutions.com> ---
Created attachment 125451
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=125451&action=edit
Bug 29134: Use a subquery to increase performance of patron attributes search

This patch generates a subquery and checks if a borrowrnumber is in the results
to add patrons
to search results

To test:
 1 - Generate a bunch of patrons:
    SELECT surname, firstname, branchcode, categorycode FROM ( SELECT surname
FROM borrowers ORDER BY rand() ) a,( SELECT firstname FROM borrowers ORDER BY
rand() ) b,( SELECT branchcode FROM borrowers ORDER BY rand() ) c,( SELECT
categorycode FROM borrowers ORDER BY rand() ) d LIMIT 50000
 2 - Add a patron attribute to the system and make it searchable - I used code
'TEST'
 3 - Add a value for this attribute to many patrons:
   INSERT INTO borrower_attributes (borrowernumber,code,attribute) SELECT
borrowernumber, 'TEST','alphabet' FROM borrowers LIMIT 10000;
 4 - In staff client got 'Patrons'
 5 - Open the browser console (F12) and view the netwrok tab
 6 - Perform a patron search for 'a'
 7 - Note the time it takes for 'search' to complete in console
 8 - Apply patch, restart_all
 9 - Repeat search
10 - Note it is much faster
11 - prove -v t/db_dependent/Utils/Datatables_Members.t

NOTE: I tested with 500k patrons and 100k attributes - search returned in ~2
seconds with patch
and did not return before I got impatient without patch

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list