2
Answers

which is best for performance filtering on where or filtering on join

Photo of ahmed salah

ahmed salah

2y
592
1

I work on sql server 2019 i don't know which is best for performance filtering on where condition or filtering on join
with another meaning which is best

first query

 select A.*  from A
 inner join B on A.ID=B.ID
 INNER JOIN C ON C.ID=B.ID
 WHERE B.name='Hazard'
    
 OR

second query

 select A.*  from A
 inner join B on A.ID=B.ID and B.name='Hazard'
 INNER JOIN C ON C.ID=B.ID

as
suppose table A have milion rows
table B have 2 milion rows
table c have 500 thousand rows

so which is best first query or second query

Answers (2)