MySQL Forums
Forum List  »  Performance

Optimization - in which order are processed the 'AND' operands?
Posted by: Emiliano Supemo
Date: April 08, 2011 06:02AM

I have a simple question.
I made a request like this on table with millions of rows :

Request 1 :

SELECT myTable.id
FROM myTable, otherTable
WHERE myTable.id =otherTable.id_cp
AND myTable.type_base =2

Everything is indexed.
I know that in this table with millions of rows, a very few of them have type_base =2.

What will be the best, request 1 or request 2 (where the order of the AND operands are inverted)? :

Request 2:

SELECT myTable.id
FROM myTable, otherTable
WHERE myTable.type_base =2
AND myTable.id =otherTable.id_cp


Does mySql process from left to right or right to left?
Does mysql process the other comparison if the first one is false?


Regards,


(Sorry for my poor english)

Options: ReplyQuote


Subject
Views
Written By
Posted
Optimization - in which order are processed the 'AND' operands?
1804
April 08, 2011 06:02AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.