MySQL MySQL中的“ADD KEY”和“ADD INDEX”有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32392890/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 21:16:10  来源:igfitidea点击:

What is the difference between "ADD KEY" and "ADD INDEX" in MySQL?

mysqlkeyalter-table

提问by Bejkrools

I dump database and i have one question. What does this query?

我转储数据库,我有一个问题。这个查询是什么?

ALTER TABLE `ps_cart_rule` ADD KEY `id_customer` (`id_customer`,`active`,`date_to`);
ALTER TABLE `ps_cart_rule` ADD KEY `id_customer_2` (`id_customer`,`active`,`highlight`,`date_to`);

What is diffrence between ADD KEYand ADD INDEX?

ADD KEYADD INDEX 有什么区别?

回答by kav

KEYis a synonym for INDEX.

KEY是 的同义词INDEX

... | ADD {INDEX|KEY} [index_name] ...

... | 添加 {INDEX|KEY} [index_name] ...

Check the MySQL documentation for ALTER TABLE.

检查ALTER TABLE的 MySQL 文档。