Home > database > Scenario questions about SQL whether can use the index
Scenario questions about SQL whether can use the index
Time:09-24
Select * from table a where a=? And b=? And c=?
Create the following index A A, c based composite index B B a separate index C C a separate index D, b, c respectively establish a separate index E, b, c based composite index
Can those options will use index
CodePudding user response:
In theory, all options are possible
CodePudding user response:
Those are bound to
CodePudding user response:
This depends on the data distribution and the amount of data, if there are only a few data, even if is built on the index, the estimate is also take a full table scan
CodePudding user response:
Shall not use, can only be possible, if the statistical information is not accurate, may be less than,
CodePudding user response:
Data quantity is large, such as in the 1000 w, statistical information is accurate, have to collect in before, the premise condition, those who would use the index
CodePudding user response:
The select floor (count (distinct) b/count (*) * 100) from a;
Use this to check the selectivity of three fields, the greater the more close to 100 more suitable for indexed