SQL optimization join [message #168451] |
Wed, 01 May 2013 08:38 |
Jack Hard
Messages: 7 Registered: December 2012
Karma: 0
|
Junior Member |
|
|
I must to have some SQL queries every day, it generally involves joins I'd like to know which is the most properly way to do a join for example in this tables
A("a",x,y)
B("b",'a',z,w)
where a and b are primary keys,
which is better?
SELECT *
FROM a,b
WHERE a.a=b.a AND a.x<constant
or
SELECT *
FROM (SELECT * FROM a WHERE x < constant) t, b
WHERE t.a=b.a
It means, is better make first the where clause and after make the join or I can do the join and after filter by where
|
|
|
|