There is index (A,B,C)-the combined Index multi-field is ordered and is a complete btree index.
- The following criteria can be used on the combined index query:
- A>5
- A=5 and B>6
- A=5 and B=6 and c=7
- A=5 and B in (2,3) and c>5
- The following conditions will not work with the combined index query:
- b>5--query condition does not contain the first column field of the combined index
- B=6 and c=7--query condition does not contain the first column field of the combined index
- The following conditions will be able to query with the upper part of the composite Index:
- A>5 and b=2--when a range query uses the first column, the query condition can only use the first column
- A=5 and B>6 and c=2--range queries use the second column, the query condition can only use the first two columns
- A=5 and B in (2,3) and c>5, all fields to the index are used. What is the principle? is automatic optimization split into a=5 and b=2 and c>5 or a=5 b=3 and c>5 two SQL? When the number of in is reached, the index can only be used in a-B column, but not in column C?
A question about MySQL in Operation index optimization