A higher proportion of columns, to which reference is made, it gives precedence over lower percentage. Generally speaking - the optimizer chooses the index for which will determine the highest percentage held by the columns. But - as already known - all the columns specified in the index, primary key or unique give precedence over any other use of the indexes.
For example:
SELECT col1, ...
FROM emp
WHEFE emp_name = 'Gurry'
AND emp_no = 127
AND emp_class - 'C1';
Indexl (emp_name, emp_class. Emp_category)
Index2 (emp_no, dept_no)
In the example above, will be used only Index1, as referenced to 67% of its columns. Index2 will not be used, because in his case the appeal relates to 50% of the indexed columns.
No comments:
Post a Comment