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

--- Comment #28 from Nick Clemens (kidclamp) <[email protected]> ---
Created attachment 207997
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207997&action=edit
Bug 38181: Look up item statuses once per record in buildKohaItemsNamespace

buildKohaItemsNamespace prefetches the holds, transfers and holds queue
rows of every item (bug 28702) and then asks each Koha::Item about its
status. Prefetching three has_many relationships makes DBIx::Class
collapse the result set, which costs close to a millisecond per item on
its own: with a thousand items the routine spends most of its time
there rather than in the database.

Fetch the itemnumbers that have a waiting recall, a holds queue entry,
a waiting hold or a current transfer with one query per table and look
the items up in those lists instead. The statuses and their precedence
are unchanged.

On a record with 1000 items (koha-testing-docker) the routine goes from
0.85s to 0.09s, and an OPAC searchResults call for that record from
1.2s to 0.45s.

Test plan:
1. prove t/db_dependent/XSLT.t
2. Pick a record with a few hundred items. Give some of its items a
   waiting hold, a holds queue entry (build_holds_queue.pl), a
   transfer in progress, a lost status
3. Search for the record on the OPAC: the availability line and the
   item statuses are the same before and after the patch, the page is
   faster
4. With UseRecalls enabled, recall one item and check that "Recall
   waiting" is still shown

Signed-off-by: Nick Clemens <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to