[Koha-bugs] [Bug 33554] New: searching borrowers is a lot slower if there's searchable extended attributes.

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Apr 18 13:07:01 CEST 2023


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

            Bug ID: 33554
           Summary: searching  borrowers is a lot slower if there's
                    searchable extended attributes.
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: Patrons
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: didier.gautheron at biblibre.com
        QA Contact: testopia at bugs.koha-community.org
                CC: gmcharlt at gmail.com, kyle.m.hall at gmail.com
        Depends on: 30055

Hi,

Since BZ 30055 search is using the REST API.

For a library with 80,000 borrowers and  800,000 borrower_attributes, (one
searchable per borrower), searching a borrower is twice as slow and is
noticeable in checkin/checkout.

before 30055 the request was something like :
SELECT borrowernumber FROM borrowers 
WHERE firstname` LIKE '%foo%' 
OR middle_name LIKE '%foo%' 
OR surname LIKE '%foo%' 
OR othernames LIKE '%foo%' 
OR cardnumber LIKE '%foo%' 
OR userid LIKE '%foo%'
OR borrowernumber in ( 
  select borrowernumber from borrower_attributes where attribute LIKE '%foo%'
AND code = 'BAR' ) 
GROUP BY borrowernumber;
runtime 0.069 sec

in master
SELECT borrowernumber FROM borrowers 
LEFT JOIN borrower_attributes USING(borrowernumber) 
WHERE firstname` LIKE '%foo%' 
OR middle_name LIKE '%foo%' 
OR surname LIKE '%foo%' 
OR othernames LIKE '%foo%' 
OR cardnumber LIKE '%foo%' 
OR userid LIKE '%foo%'
OR (attribute LIKE '%foo%' AND code = 'BAR' ) 
GROUP BY borrowernumber;

runtime 1.324 sec


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30055
[Bug 30055] Rewrite some of the patron searches to make them use the REST API
routes
-- 
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