Bugzilla – Attachment 190440 Details for
Bug 41432
Add prefetch to improve performance of holds page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41432: Prefetch items and borrowers for holds
f4810f5.patch (text/plain), 1.76 KB, created by
Martin Renvoize (ashimema)
on 2025-12-11 14:42:14 UTC
(
hide
)
Description:
Bug 41432: Prefetch items and borrowers for holds
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-12-11 14:42:14 UTC
Size:
1.76 KB
patch
obsolete
>From f4810f5db7eafa1b3e53b74e02ba7a302c68f827 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 11 Dec 2025 14:24:08 +0000 >Subject: [PATCH] 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> >--- > reserve/request.pl | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > >diff --git a/reserve/request.pl b/reserve/request.pl >index a00a6de53e1..fe5dfa6c482 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -683,8 +683,10 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > )->unblessed > } > }; >- my @reserves = >- Koha::Holds->search( { biblionumber => $biblionumber }, { order_by => 'priority' } )->as_list; >+ my @reserves = Koha::Holds->search( >+ { 'me.biblionumber' => $biblionumber }, >+ { prefetch => [ 'borrowernumber', 'itemnumber' ], order_by => 'priority' } >+ )->as_list; > foreach my $res ( > sort { > my $a_found = $a->found() || ''; >-- >2.52.0 >
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 41432
:
190438
|
190439
| 190440