Sometimes opening the moredetails.pl takes lot of time. This problem occurred when updated from 23.11 to 24.05. I think it has to do something with how many items and checkouts you have on a record, for example having 99 items and most of them are checked out.
I figured out where the problem is. It is actually in the moredetail.tt and appeared after this Bug 35310. The view starts fetching renewals for checkouts and if there are lot of renewals for each of the item the page load takes lot of time. The count should probably made in the background, using objects on the views is causing performance issues.
Created attachment 170168 [details] [review] Bug 37591: fix moredetail.tt performance issue This patch fixes the performance issue in moredetail.tt by removing the unnecessary call of checkout_renewals table. To test: 1. Create lot of checkouts and renewals for a record. 2. Open the moredetail page for the record. 3. Check the timing of the page load. 4. Apply the patch and check the timing of the page load again. 5. The page load should be faster after applying the patch. Sponsored-by: Koha-Suomi Oy
Created attachment 170169 [details] A script to add checkouts and renewals This bug is a bit hard to test. You will need lot of checkouts and data in the checkout_renewals table. In our case we have over 3 million rows in the checkout_renewals table and page load was over 2 minutes and it got reduced to 5 seconds after this patch. I made a script which you can use for testing.
Created attachment 170240 [details] [review] Bug 37591: fix moredetail.tt performance issue This patch fixes the performance issue in moredetail.tt by removing the unnecessary call of checkout_renewals table. To test: 1. Create lot of checkouts and renewals for a record. 2. Open the moredetail page for the record. 3. Check the timing of the page load. 4. Apply the patch and check the timing of the page load again. 5. The page load should be faster after applying the patch. Sponsored-by: Koha-Suomi Oy Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 170294 [details] [review] Bug 37591: fix moredetail.tt performance issue This patch fixes the performance issue in moredetail.tt by removing the unnecessary call of checkout_renewals table. To test: 1. Create lot of checkouts and renewals for a record. 2. Open the moredetail page for the record. 3. Check the timing of the page load. 4. Apply the patch and check the timing of the page load again. 5. The page load should be faster after applying the patch. Sponsored-by: Koha-Suomi Oy Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Thanks for the test script, Johanna! Starting from default KTD data and creating a bib with 2,000 items x 4 renewals each, I can confirm an improvement from 22.58s without the patch to 13.45s with the patch. The code and QA tool also look good - passing QA.
Pushed for 24.11! Well done everyone, thank you!
Backported to 24.05.x for upcoming 24.05.04
Pushed to 23.11.x for 23.11.10
Not backporting to 23.05.x unless requested