Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Cost of Query

Author  Topic 

mahesh_bote
Constraint Violating Yak Guru

298 Posts

Posted - 2007-04-24 : 06:00:06
Hi,

I have one query like

Select Tab1.A From Tab1, Tab2 Where Tab1.A = Tab2.A

but our DBA suggested to write this query using JOINS like

Select Tab1.A From Tab1 INNER JOIN Tab2 ON Tab1.A = Tab2.A

As " = " is by default INNER JOIN, i can't understand why he suggested me this? Also I have watch execution plan, Trace on server. Here it is showing 0 [Zero] duration and Minimum Reads for the 1st qry than 2nd qry. So as per the performance, which query will be best. whether 1st or 2nd.

thanks in advance,

Mahesh

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-24 : 06:02:05
They are equal.

First is "old style" join, the second is new ANSI style join.
First style is going to be deprecated in future versions of T-SQL.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

mahesh_bote
Constraint Violating Yak Guru

298 Posts

Posted - 2007-04-24 : 06:08:07
quote:
Originally posted by Peso

They are equal.

First is "old style" join, the second is new ANSI style join.
First style is going to be deprecated in future versions of T-SQL.


Peter Larsson
Helsingborg, Sweden


Thanks PESO,

but,As " = " is by default INNER JOIN, i can't understand why he suggested me this? Also I have watch execution plan, Trace on server. Here it is showing 0 [Zero] duration and Minimum Reads for the 1st qry than 2nd qry. So as per the performance, which query will be best. whether 1st or 2nd.


i thought, the 1st 1 is better than 2nd according to the performance as it is showing such results in Server Trace. May be i m wrong.


Mahesh
Go to Top of Page
   

- Advertisement -