Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old August 20th, 2004, 06:44 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cairo, , Egypt.
Posts: 336
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alyeng2000
Default issue of performance

hi all,
i am just asking what is the effiecient way of the followed exambles
1-
select * from
table1 join table2 on table1.id=table2.id

or
2-
select * from
table1,table2
where table1.id=table2.id




Ahmed Ali
Software Developer
__________________
Ahmed Ali
Senior Software Developer
Reply With Quote
  #2 (permalink)  
Old August 20th, 2004, 08:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Hudson, MA, USA.
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

These produce exactly the same query plan.

The former is the newer style, SQL-92 JOIN syntax, where the latter is "old style" notation.

There is no accounting for taste, but I prefer the newer style, as it separates the predicates used to define JOIN criteria from WHERE predicates used to select rows from the resultant JOINs. If I have a complex WHERE clause, I like to keep it focused on row selection rather than JOIN definition.

The old style begins to show problems when used in OUTER JOINS (*= syntax). There, true ambiguities can result depending on the order of WHERE clause evaluation. Removing these ambiguities was the main reason why the new syntax was proposed.

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com
Reply With Quote
  #3 (permalink)  
Old August 20th, 2004, 09:49 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cairo, , Egypt.
Posts: 336
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alyeng2000
Default

thx , so there is no performance issue
else the order for where clause in the old style



Ahmed Ali
Software Developer
Reply With Quote
  #4 (permalink)  
Old August 20th, 2004, 12:05 PM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have fond some information, I beleive off the MSDN site, where it point blank says "you will get better performance by using the new standard"

When we did our conversion from Sybaset to SQL2k - this was one of the areas we addressed - was to consider changing these old styles to new styles durring our conversion.

Unless I'm mistaken, I beleive we had some test cases that proved the need to convert to the new standard for performance reasons.

_________________________
Joe Horton
Database Developer / Software Engineer
WISHA/Legal Services Software Development
Department of Labor and Industries
Voice (360) 902-5928††fax (360) 902-6200
Reply With Quote
  #5 (permalink)  
Old August 20th, 2004, 12:46 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Hudson, MA, USA.
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

I'd love to see that reference, or examples of queries which perform differently.

I certainly haven't done an exhaustive analysis, but every time I do look, I can see no difference in the query plans between old-style and new-style JOIN syntax. My bible, "Inside SQL Server 2000", states that there is no difference in performance and that "...behind the scenes, the operations are the same...".

Whether there was or wasn't a difference, I would still advocate the new style - it's just more readable IMO.

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com
Reply With Quote
  #6 (permalink)  
Old August 20th, 2004, 12:54 PM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

here is quote from (pretty sure I found other sources too):
http://sql-server-performance.com/rd_query_tuning.asp

"Use the new ANSI JOIN syntax instead of the old style joins. The new join syntax has a slight performance advantage over the old way of using the WHERE clause for a join. The new syntax also tends to have better readability and should become the norm in your Transact-SQL coding."


_________________________
Joe Horton
Database Developer / Software Engineer
WISHA/Legal Services Software Development
Department of Labor and Industries
Voice (360) 902-5928††fax (360) 902-6200
Reply With Quote
  #7 (permalink)  
Old August 20th, 2004, 01:17 PM
Friend of Wrox
Points: 3,489, Level: 24
Points: 3,489, Level: 24 Points: 3,489, Level: 24 Points: 3,489, Level: 24
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Central, NJ, USA.
Posts: 1,102
Thanks: 0
Thanked 2 Times in 2 Posts
Default

I read something somewhere that said that in SQL 2K there was no performance advantage to the new format- however it's expected that will change in the future releases of SQL Server.

Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
performance issue with the xsl given here anboss XSLT 11 July 16th, 2008 03:05 AM
performance issue keyvanjan Classic ASP Basics 0 May 23rd, 2006 10:57 AM
Performance Issue of Execution bjohnjebastin ASP.NET 1.0 and 1.1 Basics 1 November 14th, 2005 10:18 AM
Performance issue deyakhatib SQL Server 2000 2 June 21st, 2004 10:47 PM



All times are GMT -4. The time now is 07:16 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.