mysql中如何删除表上的索引?删除索引?
需求描述:
今天在做SQL的优化的时候,想要把mysql中某个表上的索引删除掉,突然忘记语法了,找到帮助,在此记录下
操作过程:
1.查看表上的索引
show index from ti_o_sms;
备注:通过以上的查询,TI_O_SMS_IDX是一个复合索引.
2.删除这个复合索引
drop index TI_O_SMS_idx on ti_o_sms;
备注:执行完删除语句之后,再次查询,表上的复合索引已经被删除了.
3.通过help命令查看删除索引的语法
mysql> help drop index Name: 'DROP INDEX' Description: Syntax: DROP INDEX index_name ON tbl_name [algorithm_option | lock_option] ... algorithm_option: ALGORITHM [=] {DEFAULT|INPLACE|COPY} lock_option: LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE} DROP INDEX drops the index named index_name from the table tbl_name. This statement is mapped to an ALTER TABLE statement to drop the index. See [HELP ALTER TABLE]. To drop a primary key, the index name is always PRIMARY, which must be specified as a quoted identifier because PRIMARY is a reserved word: DROP INDEX `PRIMARY` ON t; URL: http://dev.mysql.com/doc/refman/5.7/en/drop-index.html mysql>
文档创建时间:2018年8月16日10:13:22