由于索引會占用一定的磁盤空間壤玫,因此父泳,為了避免影響數(shù)據(jù)庫性能枉阵,應該及時刪除不再使用的索引尘喝。
刪除索引有兩種方式
- 使用
alter table
刪除索引 - 使用
drop index
刪除索引
1. 使用alter table
刪除索引
刪除表book
中名稱為fulltextidx
的全文索引。
alter table book drop index fulltextidx;
2. 使用drop index
刪除索引
刪除t8
中名稱為·spatidx`的空間索引抵栈,SQL語句如下:
drop index spatidx on t8;