https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42609 Bug ID: 42609 Summary: Koha::Patron->strings_map triggers per-row DB queries for library and category Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org CC: tomascohen@gmail.com Depends on: 42503 Koha::Patron->strings_map calls $self->library->branchname and $self->category->description, each triggering a separate DB query per patron object. When patron+strings is embedded on list endpoints, this results in 2ÃN extra queries (N = result set size). This is particularly impactful on endpoints that return lists with embedded patron data: - /api/v1/holds/queue (bug 42503) - /api/v1/checkouts - /api/v1/holds - /api/v1/bookings - /api/v1/action_logs - /api/v1/ill/requests - /api/v1/ill/batches The fix is to use Koha::Caches with the shared 'libraries:name' cache key (already used by C4::Biblio::GetAuthorisedValueDesc and Koha::Hold::HoldsQueueItem->strings_map) and a new 'patron_categories:description' cache key. This reduces the cost to at most 2 queries total regardless of result set size. A working patch exists as a follow-up on bug 42503 and needs discussion on whether the cache invalidation strategy is acceptable for patron categories (they rarely change, and the cache is per-request in Plack). Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42503 [Bug 42503] Render the holds queue using the REST API -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.