1.where条件为 a > 5 AND a < 8 AND b = 1的时候怎么建索引?
2.where条件为 a IN ('6','7') AND b = 1 的时候怎么建索引?
补充一个问题,如果这样建立了索引index(a,b)
还有一个查询叫 WHERE a = ? AND c =?
还需要另外建立一个index(a,c)吗?
迷茫2017-04-17 13:29:45
index(a,b)
It is possible to index using composite index
IN
If you have any doubts, simulate creating a table and adding data yourself, add SELECT
before explain
and check whether to index