Optimizer in Order by clauses:

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.

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.