[Koha-bugs] [Bug 23624] New: Count rows in report without (potentially) consuming all memory
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Mon Sep 16 20:58:58 CEST 2019
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23624
Bug ID: 23624
Summary: Count rows in report without (potentially) consuming
all memory
Change sponsored?: ---
Product: Koha
Version: master
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P5 - low
Component: Reports
Assignee: koha-bugs at lists.koha-community.org
Reporter: paul at flo.org
QA Contact: testopia at bugs.koha-community.org
Created attachment 92841
-->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=92841&action=edit
Count total number of rows 1,000 at a time
C4::Reports::Guided::nb_rows (called by get_prepped_report in
reports/guided_reports.pl) uses DBI::fetchall_arrayref to retrieve all rows at
once; counts them; and then discards the rows and returns the count. This has
the potential, if the number of rows is very large, to exhaust all available
memory.
(Other code in guided_reports.pl has the same potential effect, but because the
solution to that is much less straightforward it will be addressed in a
separate bug report.)
This patch uses the second ($max_rows) parameter to DBI::fetchall_arrayref to
retrieve a smaller number (1,000) of rows at a time, looping until all results
have been retrieved. This will only use as much memory as the maximum amount
used by a single call to DBI::fetchall_arrayref.
--
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
More information about the Koha-bugs
mailing list