Bug 26535

Summary: Remove issues old_issues redundant indexes
Product: Koha Reporter: Didier Gautheron <didier.gautheron>
Component: DatabaseAssignee: Didier Gautheron <didier.gautheron>
Status: Patch doesn't apply --- QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: fridolin.somers
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 26535: Remove issues tables redundant indexes

Description Didier Gautheron 2020-09-25 08:56:44 UTC
issues and old_issues have redundant indexes.

Removing them seems to reduce dead locks occurrences.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26457

This patch doesn't try to remove existing indexes it only change DB structure for new instances.
Comment 1 Didier Gautheron 2020-09-25 09:44:13 UTC
Created attachment 110735 [details] [review]
Bug 26535: Remove issues tables redundant indexes
Comment 2 Katrin Fischer 2020-09-25 10:33:14 UTC
Hi Didier,

I think this is good, but is there a reason not to fix the existing installations of this is causing an issue? We aim to keep the database structure in sync. There are handy methods for checking on the existence of an index in the updatedatabase script that could be useful here.
Comment 3 Didier Gautheron 2020-09-25 14:06:23 UTC
Hi,
(In reply to Katrin Fischer from comment #2)
> Hi Didier,
> 
> I think this is good, but is there a reason not to fix the existing
> installations of this is causing an issue? We aim to keep the database
> structure in sync. There are handy methods for checking on the existence of
> an index in the updatedatabase script that could be useful here.
Mostly reliability.
I'm not sure testing on index name is enough, other index must exist, use the right columns, and it must be more restrictive than the deleted one.
Comment 4 Katrin Fischer 2020-09-25 14:13:43 UTC
(In reply to didier from comment #3)
> Hi,
> (In reply to Katrin Fischer from comment #2)
> > Hi Didier,
> > 
> > I think this is good, but is there a reason not to fix the existing
> > installations of this is causing an issue? We aim to keep the database
> > structure in sync. There are handy methods for checking on the existence of
> > an index in the updatedatabase script that could be useful here.
> Mostly reliability.
> I'm not sure testing on index name is enough, other index must exist, use
> the right columns, and it must be more restrictive than the deleted one.

Maybe remove them all and recreate then?
Comment 5 Fridolin Somers 2020-12-16 14:20:03 UTC
We may remove 'bordate' index, it is not safe to use timestamp into an index.
I cant find what it is for exactly.
But with ORM use, this is likly to be useless.