How to determine if an index is "USING HASH"?

时间:2018-03-23 00:33:14

标签: mysql

I've got this table definition in MySQL 5.6.39:

CREATE TABLE `_fulltexttest` (
  `hello` text NOT NULL,
  `bar` varbinary(255) NOT NULL,
  `baz` varbinary(255) NOT NULL,
  UNIQUE KEY `whatev2` (`baz`) USING HASH,
  KEY `whatev` (`bar`) USING HASH,
  KEY `baz` (`baz`) USING HASH,
  KEY `baz_2` (`baz`) COMMENT 'bacon',
  FULLTEXT KEY `hello` (`hello`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

As you can see, a few of the indexes have USING HASH.

However, when I try:

 show indexes from _fulltexttest in mydb;

Or:

SELECT *
FROM INFORMATION_SCHEMA.STATISTICS
WHERE TABLE_SCHEMA = 'mydb' and TABLE_NAME='_fulltexttest'

Neither shows "HASH" anywhere in there. The INDEX_TYPE is BTREE.

But if I do a SHOW TABLE, it shows up in the definition, so clearly it must be saved somewhere.

What query can I run to get the full index definition, including the USING HASH part?

1 个答案:

答案 0 :(得分:3)

您已经做了正确的事情来确定索引是否使用哈希。

答案是:它不是。

MySQL 5.6的文档说they haven't implemented it for InnoDB at all yet