sql server - SQL: "Where" or "AND" what performs better on large database? -


this question has answer here:

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.

  1. 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')

  2. 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

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -