-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
fix(db): remove redundant indices in properties #43339
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
Conversation
8e39447 to
bbbcc41
Compare
|
Same as #43340 (comment) |
0c798fe to
3c716c5
Compare
| if ($tableProperties->hasIndex('properties_pathonly_index') && | ||
| $tableProperties->hasIndex('properties_path_index')) { | ||
|
|
||
| $tableProperties->dropIndex('properties_pathonly_index'); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
properties_path_index is an index on (userid, propertypath). properties_pathonly_index is an index on (propertypath). The database can use properties_pathonly_index for queries on userid and userid+propertypath, but not for queries that only access propertypath.
In general, a database can use a concatenated index when searching with the leading (leftmost) columns. An index with three columns can be used when searching for the first column, when searching with the first two columns together, and when searching using all columns.
https://use-the-index-luke.com/sql/where-clause/the-equals-operator/concatenated-keys
ChristophWurst
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
properties_pathonly_index must stay
Signed-off-by: Johannes Merkel <[email protected]>
dac73c9 to
21e8aad
Compare
ChristophWurst
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😎
Summary
Remove index
property_indexandproperties_pathonly_indexbecauseproperties_path_indexalready covers columnuseridandpropertypathTODO
Checklist