Order of conditions in a WHERE clause

BeeJayEff

Registered User.
Local time
Today, 11:57
Joined
Sep 10, 2013
Messages
198
From a performance perspective, does it matter in what order a number of clauses are specified ? For example if many records satisfy ConditionA but few records satisfy ConditionB, is it better to put ConditionB first ?

SELECT Fields FROM Table WHERE ConditionA and ConditionB
or
SELECT Fields FROM Table WHERE ConditionB and ConditionA
 
My guess is that it will have to look at each row in either case so the order should not matter. However, if you have a very large dataset you should be able to test it both ways...
 

Users who are viewing this thread

Back
Top Bottom