https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38822

--- Comment #16 from Matt Blenkinsop <[email protected]> ---
Created attachment 209224
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209224&action=edit
Bug 38822: Add a period index and the erm_counter_log_summary view

The data providers summary page needs one row per usage data provider,
report type and harvest year, with the status of the latest counter log
for each month. This patch adds the database side of that:

- An index on erm_counter_logs (usage_data_provider_id, report_type,
  report_year, report_month), the natural key of a harvested month. It
  serves the view below, the Import logs tab and the retry lookup.
- A view erm_counter_log_summary, in kohastructure.sql next to
  erm_usage_yus. It keeps the newest log of each month (by importdate,
  then id) with a window function and pivots the twelve statuses into
  month_1 to month_12. Logs without a single-month period (multi-month
  harvests, uploads covering several months) are not included.
  MIN(erm_counter_log_id) gives the row a stable primary key for DBIC.

The derived table is materialised on every query, so the view scans the
single-month logs each time. With the index this stays in milliseconds
for tens of thousands of logs.

updatedatabase runs the atomicupdate files in name order, so this file
runs before bug_41307.pl, which adds the report_type, report_year,
report_month and status columns the index and the view read. The file
adds them too, under the same guards, so the first run of updatedatabase
works in either order and the file that runs second skips them.

Sponsored-by: Karlsruhe Institute of Technology (KIT)
Assisted-by: Fable 5.1 (Anthropic)

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to