indexing - Mysql - Which index is better? -
i have 2 column this:
column | column b
and these column searchable. want search both of them @ same time. should index pair of key (a,b) or index seperate , b. 1 better?
a composite index on (a, b)
may used queries involving only a
, queries involving both a
, b
, never on queries involving b
.
which index better depends on queries performing on data.
not that, order of fields in index relevant, since index on (a, b)
, index on (b, a)
may useful in different situations.
to complicate matters more, queries can use index alone without accessing data in tables, e.g., if query select b table = 5
, have index on (a, b)
, engine may traverse index, since contains data need.
Comments
Post a Comment