MySQL's index btree and hash index difference

 When using MySQL index, select the b-tree or hash

  1. hash index can satisfy only "=", "IN" and "<=>" query, the query can not be used range, such as <, since the index Hash Hash value comparison is carried out after the Hash operation, it can only be used for equivalent filtering, not based on the filtering range, because after the magnitude relation Hash value corresponding Hash algorithm after processing, and does not guarantee the Hash operation exactly the same as before
  2. For the combination of the time index, the index when calculating the Hash Hash value is calculated and then combined with the composite index key Hash value, instead of calculating the Hash value alone, the query index through the front of one or several of the composite index key, the index Hash It can not be used
  3. Hash index after the Hash operation by the index keys, the Hash value and the Hash operation result of the row corresponding to the pointer information stored in a Hash table, due to the presence of the same key index Hash values ​​are different, even if taking a Hash key meet the number of records of data, can not be completed Hash index from direct inquiries, or to make the appropriate comparisons by accessing the actual data in the table, and the corresponding results
  4. Performance will not necessarily higher than the index B-Tree index Hash encountered large Hash values ​​are equal.
  5. B-Tree indexes can be used as =,>,> =, <, <= BETWEEN these upper and comparison operators. LIKE but also for the operator, as long as it is not a query wildcard beginning constants
  6. and myisam innodb storage engine can not use the hash index .........

Guess you like

Origin www.cnblogs.com/bneglect/p/11290437.html