Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.2.0 Unnecessary suggestions for indexes that already exist as leftmost term in another index. #120

Open
Epigene opened this issue Jul 29, 2020 · 4 comments

Comments

@Epigene
Copy link

Epigene commented Jul 29, 2020

Hi,

Say there's a UniqueEvent model with a belongs_to :cause association.
unique_events table already has a multi-column uniqueness index like [:cause_id, :some_type, :uuid], unique: true, name: "very_unique_index".

lol_dba will still suggest to add a [:cause_id] index, even though there already is an index where :cause_id is the leftmost term (and no partial indexing is going on).

@plentz
Copy link
Owner

plentz commented Sep 5, 2020

@Epigene do you know if having an index com a column on the leftmost term has the same behavior in all databases?

@Epigene
Copy link
Author

Epigene commented Oct 20, 2020

Who can say about all. MySQL and PSQL definitely have the same behavior. Which ones do we seek to support?

@luisdavim
Copy link

luisdavim commented Jul 21, 2022

This is not the case for all MySQL versions....

@Epigene
Copy link
Author

Epigene commented Jul 27, 2022

@luisdavim It was the case for MySQL at the moment of writing back in 2020 and I doubt anything's changed. Here's the relevant part from MySQL v8 docs.

Are you referring to some older versions, have any specific ones in mind?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants