Bug 23387 - Cache ClassSource
Summary: Cache ClassSource
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Nick Clemens (kidclamp)
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-26 15:39 UTC by Ian Walls
Modified: 2024-11-15 17:40 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.11.00
Circulation function:


Attachments
Bug 23387: Add caching to C4::ClassSource (9.46 KB, patch)
2024-08-05 18:25 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 23387: Add caching to C4::ClassSource (9.51 KB, patch)
2024-08-23 17:57 UTC, Phil Ringnalda
Details | Diff | Splinter Review
Bug 23387: Add caching to C4::ClassSource (9.58 KB, patch)
2024-08-23 21:17 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Walls 2019-07-26 15:39:44 UTC
The data in the class_source table is not prone to frequent change, but is looked up for every biblio, biblioitem and item imported, resulting in needless DB calls and slowness.

Caching this relatively static data would provide a moderate performance boost to importing, particularly bulkmarcimport.pl
Comment 1 Katrin Fischer 2023-10-08 12:04:08 UTC
Still valid?
Comment 2 Nick Clemens (kidclamp) 2024-08-05 18:25:59 UTC
Created attachment 170076 [details] [review]
Bug 23387: Add caching to C4::ClassSource

These routines ultimately need to be moved to the Koha namespace, for now though,
we can reduce look ups during import and batch modification by caching the values
here for each request

To test:
1 - prove -v t/db_dependent/ClassSources.t
2 - Import some records with items, confirm cn_sort values correctly built
3 - Edit some items, confirm cn_Sort correclty built
Comment 3 Nick Clemens (kidclamp) 2024-08-05 18:27:44 UTC
(In reply to Katrin Fischer from comment #1)
> Still valid?

Yes, when migrating a library we noticed repeated lookups in the class sources tables from bulkmarcimport

We should go further and move to these to Koha namespace and cache at a deeper level, however, this will offer a benefit now and is a minor change
Comment 4 Phil Ringnalda 2024-08-23 17:57:24 UTC
Created attachment 170659 [details] [review]
Bug 23387: Add caching to C4::ClassSource

These routines ultimately need to be moved to the Koha namespace, for now though,
we can reduce look ups during import and batch modification by caching the values
here for each request

To test:
1 - prove -v t/db_dependent/ClassSources.t
2 - Import some records with items, confirm cn_sort values correctly built
3 - Edit some items, confirm cn_Sort correclty built

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Comment 5 Martin Renvoize (ashimema) 2024-08-23 21:17:09 UTC
Created attachment 170685 [details] [review]
Bug 23387: Add caching to C4::ClassSource

These routines ultimately need to be moved to the Koha namespace, for now though,
we can reduce look ups during import and batch modification by caching the values
here for each request

To test:
1 - prove -v t/db_dependent/ClassSources.t
2 - Import some records with items, confirm cn_sort values correctly built
3 - Edit some items, confirm cn_Sort correclty built

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 6 Martin Renvoize (ashimema) 2024-08-23 21:17:56 UTC
Clear code, well tested, noticeable improvement.

Passing QA
Comment 7 Katrin Fischer 2024-08-26 15:43:29 UTC
Pushed for 24.11!

Well done everyone, thank you!