sql server - SQL: "Where" or "AND" what performs better on large database? -
this question has answer here:
- inner join on vs clause 10 answers
i have sql query. runs on same table , creates dataset 3 columns. concern whether should use 'where' clause or 'and'. have feeling 'and' more efficient , faster 'where'. please advise. 1st 1 'where' , 2nd 1 without it.
select distinct t1.rpsrespondent id_num,t1.rpscontent pid, t2.rpscontent seqno
table t1 inner join table t2 on t1.rpsrespondent=t2.rpsrespondent inner join table t3 on t3.rpsrespondent=t1.rpsrespondent t1.rpsquestion='pid' , t2.rpsquestion = 'visitid' , t3.rpsquestion ='int99' , t3.rpscontent in('36','37')select distinct t1.rpsrespondent id_num,t1.rpscontent pid, t2.rpscontent seqno
table t1 inner join table t2 on t1.rpsrespondent=t2.rpsrespondent , t1.rpsquestion='pid' , t2.rpsquestion = 'visitid' inner join table t3 on t3.rpsrespondent=t1.rpsrespondent , t3.rpsquestion ='int99' , t3.rpscontent in('36','37')
with inner join
, makes no difference if predicates specified in join
or where
clauses. queries semantically identical sql server optimizer should generate same (optimal) executional plan. same performance result.
Comments
Post a Comment