Bug 18441 - Add primary, foreign keys to statistics table
Summary: Add primary, foreign keys to statistics table
Status: RESOLVED WONTFIX
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 5334
  Show dependency treegraph
 
Reported: 2017-04-17 23:18 UTC by Barton Chittenden
Modified: 2023-09-11 06:12 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:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Barton Chittenden 2017-04-17 23:18:14 UTC
I think that the primary key would be useful for Bug 9717 'localuse recorded for holds/transfers' -- we could record 'localuse' when the item is checked in, and then update the statistics record to 'holdcaptured' or 'transferred' if the check-in captures a hold or completes a branch transfer.

The statistics table is *very* slow to join borrowers or items against, because borrowernumber and itemnumber are not indexed. It also caused a 12 hour run of updatedatabase on site that had a large statistics table, when running the upgrade that fixed bug 14598 (itemtype is not set on statistics by C4::Circulation::AddReturn). This occurred on the 16.06.00.039 update.
Comment 1 Lari Taskula 2021-02-05 17:01:30 UTC
+1
Comment 2 Katrin Fischer 2021-02-06 16:18:04 UTC
I think sometimes it's really useful that the entries are not all 'NULLed' on deletion of an item, borrower or staff user. Especially with our current 2 table setup. I often have to dig in statistics and action_logs when "strange things" happen at the circulation desk.

Maybe insted of a FK we could just add an index?
Comment 3 Katrin Fischer 2023-09-10 21:41:54 UTC
(In reply to Katrin Fischer from comment #2)
> I think sometimes it's really useful that the entries are not all 'NULLed'
> on deletion of an item, borrower or staff user. Especially with our current
> 2 table setup. I often have to dig in statistics and action_logs when
> "strange things" happen at the circulation desk.
> 
> Maybe insted of a FK we could just add an index?

Never got a reply here. Marking WONTFIX, please re-open if you disagree.
Comment 4 Martin Renvoize 2023-09-11 06:12:59 UTC
In this case I agree, I don't think I'd use a foreign key but I see no issue with adding indexes for performance.