MySQL单列索引与复合索引选择
生活随笔
收集整理的這篇文章主要介紹了
MySQL单列索引与复合索引选择
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
單列索引和復合索引。
盡量使用復合索引,而少使用單列索引 。
創建復合索引
create index idx_name_sta_address on tb_seller(name, status, address);就相當于創建了三個索引 : namename + statusname + status + address創建單列索引
create index idx_seller_name on tb_seller(name); create index idx_seller_status on tb_seller(status); create index idx_seller_address on tb_seller(address);數據庫會選擇一個最優的索引(辨識度最高索引)來使用,并不會使用全部索引 。
總結
以上是生活随笔為你收集整理的MySQL单列索引与复合索引选择的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MySQL高级in和not in
- 下一篇: MySQL查看索引使用情况