Summary: | all_libraries routine in library groups make a DB call per member of group | ||
---|---|---|---|
Product: | Koha | Reporter: | Nick Clemens (kidclamp) <nick> |
Component: | Architecture, internals, and plumbing | Assignee: | Nick Clemens (kidclamp) <nick> |
Status: | CLOSED FIXED | QA Contact: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Severity: | normal | ||
Priority: | P5 - low | CC: | andrew, jonathan.druart, kyle, tomascohen, victor |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | Trivial patch | Documentation contact: | |
Documentation submission: | Text to go in the release notes: | ||
Version(s) released in: |
22.05.00,21.11.02,21.05.09
|
Circulation function: | |
Attachments: |
Bug 29702: fetch group libraries in a single call
Bug 29702: fetch group libraries in a single call Bug 29702: Fetch group libraries in a single call |
Description
Nick Clemens (kidclamp)
2021-12-15 15:44:03 UTC
Created attachment 128572 [details] [review] Bug 29702: fetch group libraries in a single call The current code gets all group members, then loops through and fetches the library if there is a branchcode, or recursively calls itself if a group. This slows down performance. We can utilize the 'libraries' method to get all child libraries at once, then make a check for child groups separately To recreate: 1 - Add 100 items to a biblio 2 - Define a library group as a hold group 3 - Add all libraries to the group 4 - Set 'Default checkout, hold and return policy'->'Hold pickup library match' = 'Any library' 5 - place a hold on the record and note load time after patron is selected 6 - Set 'Default checkout, hold and return policy'->'Hold pickup library match' = 'Patrons hold group' 7 - place a hold, note longer load time after patron selection 8 - Apply patch 9 - note improvement 10 - prove -v t/db_dependent/Koha/Libraries.t Created attachment 128843 [details] [review] Bug 29702: fetch group libraries in a single call The current code gets all group members, then loops through and fetches the library if there is a branchcode, or recursively calls itself if a group. This slows down performance. We can utilize the 'libraries' method to get all child libraries at once, then make a check for child groups separately To recreate: 1 - Add 100 items to a biblio 2 - Define a library group as a hold group 3 - Add all libraries to the group 4 - Set 'Default checkout, hold and return policy'->'Hold pickup library match' = 'Any library' 5 - place a hold on the record and note load time after patron is selected 6 - Set 'Default checkout, hold and return policy'->'Hold pickup library match' = 'Patrons hold group' 7 - place a hold, note longer load time after patron selection 8 - Apply patch 9 - note improvement 10 - prove -v t/db_dependent/Koha/Libraries.t Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Created attachment 129116 [details] [review] Bug 29702: Fetch group libraries in a single call The current code gets all group members, then loops through and fetches the library if there is a branchcode, or recursively calls itself if a group. This slows down performance. We can utilize the 'libraries' method to get all child libraries at once, then make a check for child groups separately To recreate: 1 - Add 100 items to a biblio 2 - Define a library group as a hold group 3 - Add all libraries to the group 4 - Set 'Default checkout, hold and return policy'->'Hold pickup library match' = 'Any library' 5 - place a hold on the record and note load time after patron is selected 6 - Set 'Default checkout, hold and return policy'->'Hold pickup library match' = 'Patrons hold group' 7 - place a hold, note longer load time after patron selection 8 - Apply patch 9 - note improvement 10 - prove -v t/db_dependent/Koha/Libraries.t Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> We could try using closure tables to optimize even further. Pushed to master for 22.05, thanks to everybody involved [U+1F984] Pushed to 21.11.x for 21.11.02 Pushed to 21.05.x for 21.05.09 Not backported to oldoldstable (20.11.x). Feel free to ask if it's needed. |