Ive got a SQL query with 2 inner joins, one of which involves a large table. Essentially its a search tool for info in our DB.
So the query is along the lines of:
SELECT stuff, things, wotsits
FROM tbl_One
INNER JOIN tbl_Two ON tbl_One.stuff_ID = tbl_Two.stuff_ID
INNER JOIN tbl_Three ON tbl_One.things_ID = tbl_Three.things_ID
WHERE
stuff_ID > 100 AND things_ID < 5000
AND
...some CONTAINS criteria...
(hope that makes sense)
Question is: are the "where" parts done before the joins? Or will the joins be involving the whole table(s) and then filtered down?
Reason is: the query is taking too long! But only when certain criteria are in place, which makes me think its got something to do with the "where" parts....
I know im probably being too vague (but Im ill!) so hope you can help ;-)
So the query is along the lines of:
SELECT stuff, things, wotsits
FROM tbl_One
INNER JOIN tbl_Two ON tbl_One.stuff_ID = tbl_Two.stuff_ID
INNER JOIN tbl_Three ON tbl_One.things_ID = tbl_Three.things_ID
WHERE
stuff_ID > 100 AND things_ID < 5000
AND
...some CONTAINS criteria...
(hope that makes sense)
Question is: are the "where" parts done before the joins? Or will the joins be involving the whole table(s) and then filtered down?
Reason is: the query is taking too long! But only when certain criteria are in place, which makes me think its got something to do with the "where" parts....
I know im probably being too vague (but Im ill!) so hope you can help ;-)