Mysql-索引

添加索引ide

alter table 表名 add index/unique/fulltext [索引名] (字段名);

刪除索引code

alter table 表名 drop index 索引名;

查看錶的全部索引索引

show index from 表名;

注意:索引在提供查找速度的同時,下降增刪改的速度
普通索引 key(字段名1,字段名2,......)
惟一索引 unique key(字段名1,字段名2,......)
主鍵索引 primary key(字段名1,字段名2,......)
全文索引 fulltext(字段名1,字段名2,......)
組合索引 index(字段名1,字段名2,......)
外鍵約束 foreign key(字段) references 表名(字段名) innoDB支持it

相關文章
相關標籤/搜索