Bug 41432 - Add prefetch to improve performance of holds page
Summary: Add prefetch to improve performance of holds page
Status: Passed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Hold requests (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Nick Clemens (kidclamp)
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-12-11 14:23 UTC by Nick Clemens (kidclamp)
Modified: 2025-12-11 14:42 UTC (History)
5 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 41432: Prefetch items and borrowers for holds (1.64 KB, patch)
2025-12-11 14:25 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 41432: Prefetch items and borrowers for holds (1.70 KB, patch)
2025-12-11 14:26 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 41432: Prefetch items and borrowers for holds (1.76 KB, patch)
2025-12-11 14:42 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2025-12-11 14:23:53 UTC
To view the issue:
1 - Add a bunch of holds to a record
    https://github.com/kidclamp/handy-koha-script/blob/main/randhold.pl
2 - Enable profiling:
    https://wiki.koha-community.org/wiki/Profiling_with_Devel::NYTProf#NYTProf_with_Plack
3 - Browse to the record and load the holds table
4 - View the flame graph for the request like instructions in #2
5 - Note that Koha::Hold->borrower and Koha::Hold->item take a lot of time
Comment 1 Nick Clemens (kidclamp) 2025-12-11 14:25:45 UTC
Created attachment 190438 [details] [review]
Bug 41432: Prefetch items and borrowers for holds

To test:
1 - Add a bunch of holds to a record
    https://github.com/kidclamp/handy-koha-script/blob/main/randhold.pl
2 - Enable profiling:
    https://wiki.koha-community.org/wiki/Profiling_with_Devel::NYTProf#NYTProf_with_Plack
3 - Browse to the record and load the holds table
4 - View the flame graph for the request like instructions in #2
5 - Note that Koha::Hold->borrower and Koha::Hold->item take a lot of time
6 - Apply patch, restart all
7 - Reload page
8 - Reload flame graph
9 - Note time for fetching borrowers and items is significantly reduced
10 - Sing off!
Comment 2 Nick Clemens (kidclamp) 2025-12-11 14:26:00 UTC
Created attachment 190439 [details] [review]
Bug 41432: Prefetch items and borrowers for holds

To test:
1 - Add a bunch of holds to a record
    https://github.com/kidclamp/handy-koha-script/blob/main/randhold.pl
2 - Enable profiling:
    https://wiki.koha-community.org/wiki/Profiling_with_Devel::NYTProf#NYTProf_with_Plack
3 - Browse to the record and load the holds table
4 - View the flame graph for the request like instructions in #2
5 - Note that Koha::Hold->borrower and Koha::Hold->item take a lot of time
6 - Apply patch, restart all
7 - Reload page
8 - Reload flame graph
9 - Note time for fetching borrowers and items is significantly reduced
10 - Sing off!

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 3 Nick Clemens (kidclamp) 2025-12-11 14:26:17 UTC
Trivial, self SO
Comment 4 Martin Renvoize (ashimema) 2025-12-11 14:42:14 UTC
Created attachment 190440 [details] [review]
Bug 41432: Prefetch items and borrowers for holds

To test:
1 - Add a bunch of holds to a record
    https://github.com/kidclamp/handy-koha-script/blob/main/randhold.pl
2 - Enable profiling:
    https://wiki.koha-community.org/wiki/Profiling_with_Devel::NYTProf#NYTProf_with_Plack
3 - Browse to the record and load the holds table
4 - View the flame graph for the request like instructions in #2
5 - Note that Koha::Hold->borrower and Koha::Hold->item take a lot of time
6 - Apply patch, restart all
7 - Reload page
8 - Reload flame graph
9 - Note time for fetching borrowers and items is significantly reduced
10 - Sing off!

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>