Wednesday, October 14, 2015

Comparison of B-Tree and Hash Indexes

A B-tree index can be used for column comparisons in expressions that use the =, >, >=, <, <=, or BETWEEN operators. The index also can be used for LIKE comparisons if the argument to LIKE is a constant string that does not start with a wildcard character.

Hash indexes are used only for equality comparisons that use the = or <=> operators (but are very fast). They are not used for comparison operators such as < that find a range of values. Only whole keys can be used to search for a row. (With a B-tree index, any leftmost prefix of the key can be used to find rows.)

For more information: https://dev.mysql.com/doc/refman/5.5/en/index-btree-hash.html

No comments:

Post a Comment