對於這樣單柱或複合指數
[ col1 - col2 - col3 - col4 ]
[ 1 - 2 - 3 - 4 ]
我將使用兩種類型的查詢在兩種情況下
一個表是SELECT * FROM table WHERE col1 = 1 AND col2 = 2 AND col3 = 3;
另一個是SELECT * FROM table WHERE col1 = 1 AND col2 = 2 AND col4 = 4;
在這種情況下,我可以製作一個
composite index
只col1 AND col2
和col3 AND col4
一個single-column index
還是我去
ALL
列single-column index
或把
ALL
列在composite index
邊問:我有命名索引?什麼是索引大小?
@a_horse_with_no_name mysql –