database indexes - Are the MySQL query performance benefits of indices retained if a subset of the index columns are used in a query? -
do maintain performance , efficiency advantages of having index setup multiple columns on mysql table if run select statement queries subset of columns in index?
so, if have index setup on columns a, b , c statement queries columns , b, same having no index setup @ all. need have index setup exclusively , b gain performance benefits queries?
see answer: http://stackoverflow.com/a/20939127/2520738
basically:
if table has multiple-column index, leftmost prefix of index can used optimizer rows. example, if have three-column index on (col1, col2, col3), have indexed search capabilities on (col1), (col1, col2), , (col1, col2, col3).
so basically, yes, if index reads a, b, c left right, can search on a, , b, , b , c. if don't have single column indexes on b or c no index used when searched individually.
mysql database-indexes
No comments:
Post a Comment