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.
-
Which engine do you use (InnoDB, MyISAM, Memory ...) ?Imanez– Imanez2017-01-30 09:18:07 +00:00Commented Jan 30, 2017 at 9:18
-
InnoDB --------Oo Dee– Oo Dee2017-01-30 09:40:23 +00:00Commented 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.Rick James– Rick James2017-01-30 18:10:07 +00:00Commented Jan 30, 2017 at 18:10
Add a comment
|
1 Answer
InnoDb and MyIsam don't support Hash index ( https://dev.mysql.com/doc/refman/5.7/en/create-index.html )
But you can use adaptive hash index ( https://dev.mysql.com/doc/refman/5.7/en/innodb-adaptive-hash.html )
