ahmed salah

ahmed salah

  • 937
  • 487
  • 30.2k

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

Jul 28 2022 7:11 AM

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)