Mysql 我们需要向多列索引添加主键吗?
我们需要向多列索引添加主键吗?或者它会自动放在那里Mysql 我们需要向多列索引添加主键吗?,mysql,sql,wordpress,Mysql,Sql,Wordpress,我们需要向多列索引添加主键吗?或者它会自动放在那里 ALTER TABLE `wp_posts` ADD PRIMARY KEY (`ID`), ADD KEY `post_name` (`post_name`(191)), ADD KEY `type_status_date` (`post_type`,`post_status`,`post_date`,`ID`), ADD KEY `post_parent` (`post_parent`), ADD KEY `post_a
ALTER TABLE `wp_posts`
ADD PRIMARY KEY (`ID`),
ADD KEY `post_name` (`post_name`(191)),
ADD KEY `type_status_date` (`post_type`,`post_status`,`post_date`,`ID`),
ADD KEY `post_parent` (`post_parent`),
ADD KEY `post_author` (`post_author`);
我得出了一个结论,他们把ID放在那里,因为“按ID排序”会更快,因为引擎不需要排序,而是按照索引排序
索引结构取决于所使用的存储引擎。您能更清楚地解释一下吗。