gpt4 book ai didi

mysql - InnoDB,如何检测索引类型?

转载 作者:可可西里 更新时间:2023-11-01 08:32:28 26 4
gpt4 key购买 nike

我有一张 table :

CREATE TABLE  `posts` (
`post_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`topic_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
`forum_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
`poster_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
`icon_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
`poster_ip` varchar(40) COLLATE utf8_bin NOT NULL DEFAULT '',
`post_time` int(11) unsigned NOT NULL DEFAULT '0',
`post_approved` tinyint(1) unsigned NOT NULL DEFAULT '1',
`post_reported` tinyint(1) unsigned NOT NULL DEFAULT '0',
`enable_bbcode` tinyint(1) unsigned NOT NULL DEFAULT '1',
`enable_smilies` tinyint(1) unsigned NOT NULL DEFAULT '1',
`enable_magic_url` tinyint(1) unsigned NOT NULL DEFAULT '1',
`enable_sig` tinyint(1) unsigned NOT NULL DEFAULT '1',
`post_username` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
`post_subject` blob,
`post_text` mediumtext COLLATE utf8_bin NOT NULL,
`post_checksum` varchar(32) COLLATE utf8_bin NOT NULL DEFAULT '',
`post_attachment` tinyint(1) unsigned NOT NULL DEFAULT '0',
`bbcode_bitfield` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
`bbcode_uid` varchar(8) COLLATE utf8_bin NOT NULL DEFAULT '',
`post_postcount` tinyint(1) unsigned NOT NULL DEFAULT '1',
`post_edit_time` int(11) unsigned NOT NULL DEFAULT '0',
`post_edit_reason` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
`post_edit_user` mediumint(8) unsigned NOT NULL DEFAULT '0',
`post_edit_count` smallint(4) unsigned NOT NULL DEFAULT '0',
`post_edit_locked` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`post_id`),
KEY `forum_id` (`forum_id`),
KEY `topic_id` (`topic_id`),
KEY `poster_ip` (`poster_ip`),
KEY `poster_id` (`poster_id`),
KEY `post_approved` (`post_approved`),
KEY `post_username` (`post_username`),
KEY `tid_post_time` (`topic_id`,`post_time`) USING HASH
) ENGINE=InnoDB AUTO_INCREMENT=22381 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

如您所见,最后一个索引是“USING HASH”——但是当我使用show indexes from posts; 时,并没有显示它

最佳答案

经过快速Google search , 我很快发现 InnoDB doesn't support HASH indexes , 但仍然接受表定义中的修饰符。

SHOW CREATE TABLE 可能会显示 USING HASH,但是 SHOW INDEXES实际上会告诉你正在使用什么索引类型:

Index_type

The index method used (BTREE, FULLTEXT, HASH, RTREE).

关于mysql - InnoDB,如何检测索引类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23634242/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com