MYSQL索引
#對表添加索引
//表index_tbl:
+-------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(32) | YES | MUL | NULL | |
+-------+-------------+------+-----+---------+----------------+
#index_tbl 為欲添加的表名,name為添加索引的Fiel,index_name為添加name的自定義名稱
CREATE INDEX index_name on index_tbl(name);
#查詢索引
#圖中的PRIMARY為主鍵索引,在創建時為id添加的primary key
SHOW INDEX FROM index_tbl;
>>>
#刪除索引
DROP INDEX index_name ON index_tbl;
#查詢
SHOW INDEX FROM index_tbl;
>>>