ibazz — 2010-01-17T21:58:59-05:00 — #1
I think the answer may be yes but I need to be sure...
If I query my table, and I have a WHERE and 2 AND clauses; do they each reduce the data set that the next clause has to deal with such that the query becomes leaner as it is processed or; do they all get applied at the same time, at the end of the query?
say I query this
from addresses as AD
left outer join
possible_countries as PC
on PC.country = AD.country
and PC.state = AD.state
where AD.country = 'France'
AND AD.state = 'Quebec'
and '[mathematical calc here]'
Will the WHERE & 1st AND reduce the data that the 2nd AND must manipulate?
r937 — 2010-01-17T22:04:53-05:00 — #2
i expect all the WHERE conditions on the AD table are processed together, during retrieval of rows from the AD table
whatever rows pass those filters are then matched to PC rows
you can see the sequence of operations by doing an EXPLAIN
p.s. does france actually have a quebec province?
ibazz — 2010-01-18T06:53:52-05:00 — #3
Thanks Rudy, I'll do an explain to try to understand.
lol, no. That was just example data.