Summary: | C4::Languages::getLanguages is very unreasonably slow (100+ ms) | ||
---|---|---|---|
Product: | Koha | Reporter: | Michał <schodkowy.omegi-0r> |
Component: | Searching | Assignee: | Michał <schodkowy.omegi-0r> |
Status: | Needs Signoff --- | QA Contact: | Testopia <testopia> |
Severity: | normal | ||
Priority: | P5 - low | CC: | david, fridolin.somers, januszop, jonathan.druart, roman.dolny, schodkowy.omegi-0r |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38630 | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Attachments: | [PATCH] Bug 38646: rewrite C4::Languages::getLanguages to use a single cachable SQL query |
Description
Michał
2024-12-06 14:58:31 UTC
Created attachment 175262 [details] [review] [PATCH] Bug 38646: rewrite C4::Languages::getLanguages to use a single cachable SQL query Also I was thinking of alternative approach to handle AdvancedSearchLanguages, but it seemed more sketchy and with ~200 langs performance of FIND_IN_SET shouldn't be any problem whatsoever. The alternative idea was: my @search_langs; my $language_list_cond = ''; my $language_list = $isFiltered ? C4::Context->preference("AdvancedSearchLanguages") : undef; if ($language_list) { @search_langs = split(/,|\|/, $language_list); my $params = join ', ' => ('?') x @search_langs; $language_list_cond = 'AND language_rfc4646_to_iso639.iso639_2_code IN ($params)'; } #... -- Grab ISO code for language INNER JOIN language_rfc4646_to_iso639 ON language_rfc4646_to_iso639.rfc4646_subtag = language_subtag_registry.subtag AND language_rfc4646_to_iso639.iso639_2_code IS NOT NULL ${language_list_cond} #... if ($language_list) { $sth->execute(@search_langs, $current_language); } else { $sth->execute($current_language); } ^Unless someone believes the above is better? Hi Michal, Thanks for working on improving the performance, and submitting a patch! I can't comment on the code and approach, but I'm sure others will! I mainly help with testing bugs and signing them off before they go to QA. If you could add a test plan, that would be great. This should ideally set out how to replicate the issue, apply the patch, and then show how it fixes or improves things. See the commit message guidelines for what to include https://wiki.koha-community.org/wiki/Commit_messages Feel free to ask on the bug if you need any help, or on the Koha Community's Development chat channel https://chat.koha-community.org/ Some other links: - Most Koha developers use koha-testing-docker (KTD) for their development environment - it gives you a complete Koha environment with all the required tools including a working instance and sample data, see https://gitlab.com/koha-community/koha-testing-docker - This page about the development workflow may be useful if you are unfamiliar with how Koha does things https://wiki.koha-community.org/wiki/Development_workflow David Nind Whooo good catch, I will try |