Optimizer in Order by clauses:
Optimizer in Order by clauses:
The optimizer will skip the sort procedure for the ORDER BY clause if it sees that the rows will be in order anyway.
For the query:
SELECT * FROM Table1
WHERE column1 > ‘x’ AND column2 > ‘x’
ORDER BY column2;
if both column1 and column2 are indexed, the optimizer will choose an index on … column1. The fact that ordering takes place by column2 values does not affect the choice of driver in this case.
