Sites with very large numbers of imported records may experience increasingly slow z39.50 searches. This is cause by the triggering of the subroutine _update_batch_record_counts for each and every result of a z39.50 search. Fixing this will be very difficult though. However, I have discovered a much simpler solution that, while not as good as bypassing _update_batch_record_counts, still gives a dramatic boost to speed, adding an index to import_records for import_batch_id/record_type ALTER TABLE import_records ADD INDEX batch_id__record_type ( import_batch_id, record_type )
Created attachment 13872 [details] [review] Bug 9207 - Improve z39.50 speed slowdowns for sites with many records
Depending on the number of servers that are being searched, there may be a lesser slowdown caused by ZOOM not releasing the resultsets and connections after it's done. Whether this is making a difference in your particular case, of course, I couldn't say.
Created attachment 15967 [details] [review] Bug 9207 - Improve z39.50 speed slowdowns for sites with many records Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
I tested the new index, but it is hard to say if it is really faster with just a few thousand records in import_records. I have timed with Time::HiRes a few times, and got slightly better results. But just running the queries like _update_batch_record_counts does in mysql did not really make a difference. Nevertheless, I can imagine that this index makes a difference when you have much more records. Tested the upgrade. Tested the install by running kohastructure partially from command-line. Amended the patch for a small detail: there is no index in Koha with two underscores in the name. So I removed one underscore. No further QA comments: Passed QA
This patch has been pushed to master.
Pushed to 3.10.x and 3.8.x will be in 3.10.4 and 3.8.11