Mysql優化-為表字段新增索引
阿新 • • 發佈:2018-11-30
1.新增PRIMARY KEY(主鍵索引):
ALTER TABLE `table_name` ADD PRIMARY KEY ( `column` )
2.新增UNIQUE(唯一索引) :
ALTER TABLE `table_name` ADD UNIQUE ( `column` ) 3.新增INDEX(普通索引) : ALTER TABLE `table_name` ADD INDEX index_name ( `column` ) 4.新增FULLTEXT(全文索引) : ALTER TABLE `table_name` ADD FULLTEXT ( `column`) 5.新增多列索引: ALTER TABLE `table_name` ADD INDEX index_name ( `column1`, `column2`, `column3` )ALTER TABLE `table_name` ADD PRIMARY KEY ( `column` )
2.新增UNIQUE(唯一索引) :
ALTER TABLE `table_name` ADD UNIQUE ( `column` ) 3.新增INDEX(普通索引) : ALTER TABLE `table_name` ADD INDEX index_name ( `column` ) 4.新增FULLTEXT(全文索引) : ALTER TABLE `table_name` ADD FULLTEXT ( `column`) 5.新增多列索引: ALTER TABLE `table_name` ADD INDEX index_name ( `column1`, `column2`, `column3` )