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

[email protected] <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #25 from [email protected] <[email protected]> ---
Created attachment 207792
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207792&action=edit
Bug 38181: Check OPAC item visibility once per record in searchResults

Profiled this on a 25.05 production OPAC (Zebra, MySQL on a separate host)
where a search page with records of 300-500 items took 20-40 s. The search
engine answers in milliseconds; nearly all of the time is item processing in
Perl, in two places:

1. C4::Search::searchResults checks OPAC visibility (OpacHiddenItems /
hidelostitems) with one Koha::Items query per item.
2. C4::XSLT::buildKohaItemsNamespace asks every item for its holds queue,
waiting hold and transfer status. Since bug 28702 these come from prefetched
relationships, but prefetching three has_many relationships makes DBIx::Class
collapse the result set, which costs close to a millisecond per item on its
own.

The two patches do the lookups once per record (one query per table over the
itemnumbers of the record) and keep the statuses and their precedence
unchanged. Tests added for both.

koha-testing-docker, one record with 1000 items, OPAC:
- searchResults: 1.8 s / 1063 queries -> 0.41 s / 20 queries
- buildKohaItemsNamespace alone: 0.85 s -> 0.06 s

On the 25.05 production site (patches ported, run as CGI so ~3.5 s of each
figure is startup): the result page for a 523-item record went from 19 s to 9
s, for a 364-item record from 16 s to 8 s. A page of 20 ordinary records barely
changes (7.0 s -> 6.5 s), as expected.

Related: bug 36261 describes the same per-item visibility problem; bug 36239
the availability part.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
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