mysql - 范围条件查询怎么建索引?
阿神
阿神 2017-04-17 13:27:45
0
1
913

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)吗?

阿神
阿神

闭关修行中......

reply all(1)
迷茫

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template