sql - Performance impacts on specifying multiple columns in inner join -
i want select records 2 tables based on matching values of 2 columns. have got 2 queries same, out of these 1 contains join on 2 columns as:
select * user_master um inner join user_location ul on um.customer_id=ul.customer_id , um.created_by=ul.user_id
and same results can achieved following query having single column join as:
select * user_master um inner join user_location ul on um.created_by=ul.user_id um.customer_id=ul.customer_id
is there difference in performance of above queries?
as concerning performance answer is: depends.
in general engine smart enough optimize both queries, i'm not surprised if both produce same execution plan.
in fact must run both queries few times , study execution plan determine if both run same time and using same amount of cpu, io , memory. (remember performance not running fast, smart use of resources).
for "semantic" vision, data using 2 keys "determined". in case can let both expression @ join predicate. let filters @ clause. advantage of explicit joins on implicit ones create logic (and visual) separation
Comments
Post a Comment