fe18b05692
In UNIMARC instances, the run time of link_bibs_to_authorities.pl can be reduced by up to 80% and the number of DBI calls can be reduced by up to 90% with a very simple fix that optimises the constructor of the C4::Heading::UNIMARC object. Currently, the constructor resets the $bib_heading_fields hash *in each invocation* (i.e. for every field the bibliographic record contains), then populating it again with the results fetched from the database! This is inefficient. The patch/fix is trivial: we take advantage of the fact that $bib_heading_fields is declared at the top of the C4::Heading::UNIMARC module and is thus a package variable that is in scope for the entire execution of the program (more info here: https://stackoverflow.com/q/75317862). Placing the section that generates the $bib_heading_fields hash inside a "unless ( defined $bib_heading_fields )" code block is enough to cause a significant reduction in the number of "expensive" SQL SELECT queries that must be run. Test plan: 0) Have a UNIMARC instance with some sample data (the KTD one will do just fine for this experiment). 1) Run the following commands: $ ktd --shell k$ DBI_PROFILE=1 ./misc/link_bibs_to_authorities.pl -t Observe the output from the script and the DBI profiling info. [You may want to play with different DBI_PROFILE levels (such as 2, 4, 6, 8, etc.) to see what's going on under the hood DBI-wise, for reference see: https://metacpan.org/pod/DBI::Profile] 2) Apply this patch. 3) Rerun the script from step 1), it should run a lot faster! Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> |
||
---|---|---|
.. | ||
AuthoritiesMarc | ||
Barcodes | ||
ClassSortRoutine | ||
ClassSplitRoutine | ||
Creators | ||
External | ||
Form | ||
Heading | ||
ILSDI | ||
Installer | ||
Labels | ||
Linker | ||
Members | ||
OAI | ||
Output | ||
Patroncards | ||
Reports | ||
Search | ||
Serials | ||
SIP | ||
Utils | ||
Accounts.pm | ||
Acquisition.pm | ||
Auth.pm | ||
Auth_cas_servers.yaml.sample | ||
Auth_with_cas.pm | ||
Auth_with_ldap.pm | ||
Auth_with_shibboleth.pm | ||
AuthoritiesMarc.pm | ||
Barcodes.pm | ||
Biblio.pm | ||
Breeding.pm | ||
Budgets.pm | ||
Calendar.pm | ||
Charset.pm | ||
Circulation.pm | ||
ClassSortRoutine.pm | ||
ClassSource.pm | ||
ClassSplitRoutine.pm | ||
Context.pm | ||
Contract.pm | ||
CourseReserves.pm | ||
Creators.pm | ||
Heading.pm | ||
HoldsQueue.pm | ||
HTML5Media.pm | ||
ImportBatch.pm | ||
ImportExportFramework.pm | ||
InstallAuth.pm | ||
Installer.pm | ||
ItemCirculationAlertPreference.pm | ||
Items.pm | ||
Koha.pm | ||
Labels.pm | ||
Languages.pm | ||
Letters.pm | ||
Linker.pm | ||
Log.pm | ||
MarcModificationTemplates.pm | ||
Matcher.pm | ||
Members.pm | ||
Message.pm | ||
Output.pm | ||
Overdues.pm | ||
Patroncards.pm | ||
Record.pm | ||
Reports.pm | ||
Reserves.pm | ||
Ris.pm | ||
RotatingCollections.pm | ||
Scheduler.pm | ||
Scrubber.pm | ||
Search.pm | ||
Serials.pm | ||
Service.pm | ||
ShelfBrowser.pm | ||
SMS.pm | ||
SocialData.pm | ||
Stats.pm | ||
Suggestions.pm | ||
Tags.pm | ||
Templates.pm | ||
TmplToken.pm | ||
TmplTokenType.pm | ||
TTParser.pm | ||
UsageStats.pm | ||
XISBN.pm | ||
XSLT.pm |