Thursday, March 22, 2012

apt select

Hi all,

can any one clearly distinguish between the following 2 select stmts.
which one should I Choose for better performance.

1) select * from tab1,tab2,tab3,tab4
where tab1.Id1=tab2.Id
and tab1.Id2=tab3.Id
and tab1.Id3=tab4.Id

2)select * from tab1 join tab2
on tab1.Id1=tab2.Id
join tab3
on tab1.Id2=tab3.Id
join tab4
on tab1.Id3=tab4.Idwell..............
this is an old one.and i will give the "check it out for yourself" answer first.
....depending on record size and count, (and other factors). the only true test is to check statistics [TIME and IO] against each executed (or estimated) running of the queries..

now for my opinion.
there is no difference between the two.
I prefer the ansi joins sheerly from an portability aspect. everyone who is anyone is using them (even oracle has switched to ansi joins as per 9i).

just me however.

A GIS for "join style" returns a consensus on this matter "no real difference but your code will be portable".

No comments:

Post a Comment