2

On MySQL 5.7, I whenever I create an index, despite specifying its type (BTREE or HASH), the index created is always BTREE. Does anyone know how to enable HASH for indexing? I plan to use it on low cardinality columns.

3
  • Which engine do you use (InnoDB, MyISAM, Memory ...) ? Commented Jan 30, 2017 at 9:18
  • InnoDB -------- Commented Jan 30, 2017 at 9:40
  • Hash, if it existed, would be only marginally better than BTree for point queries, and would be useless for "range" queries. So, they did not bother to include it. Commented Jan 30, 2017 at 18:10

1 Answer 1

4

InnoDb and MyIsam don't support Hash index ( https://dev.mysql.com/doc/refman/5.7/en/create-index.html )

enter image description here

But you can use adaptive hash index ( https://dev.mysql.com/doc/refman/5.7/en/innodb-adaptive-hash.html )

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.