fix(db): remove redundant indices in properties#43339
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.
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.
properties_pathonly_index must stay
Signed-off-by: Johannes Merkel <mail@johannesgge.de>
dac73c9 to
21e8aad
Compare
Summary
Remove index
property_indexandproperties_pathonly_indexbecauseproperties_path_indexalready covers columnuseridandpropertypathTODO
Checklist