Does Query Speed Depend on Order of WHERE Clause (1 Viewer)

SmallTime

Registered User.
Local time
Today, 10:40
Joined
Mar 24, 2011
Messages
246
Just writing some queries for 500K + records with a various restrictions in the WHERE clause and was wondering if the order in which I restricted the data would have any affect on query performance. Is it better to place the broadest restriction first and then filter down form there or does it not make any significant difference?
 

MarkK

bit cruncher
Local time
Today, 10:40
Joined
Mar 17, 2004
Messages
8,187
I think the biggest impact on performance will be if you apply constraints to fields that are indexed.
 

SmallTime

Registered User.
Local time
Today, 10:40
Joined
Mar 24, 2011
Messages
246
Many thanks for that, I always thought the opposite was true, but will have a quick read-up in the morning.

Ta
 

spikepl

Eledittingent Beliped
Local time
Today, 19:40
Joined
Nov 3, 2010
Messages
6,142
I suspect MarkK meant what you thought, i.e. applying indexing to fields with constraints :D

But google access query optimise There are many other aspects though perhaps of lesser significance.
 

SmallTime

Registered User.
Local time
Today, 10:40
Joined
Mar 24, 2011
Messages
246
Ah ha, reading it again I see that's exactly what Mark meant.

Sorry combinations of late night and square eyes.

Thanks
 

Users who are viewing this thread

Top Bottom