Results 1 to 4 of 4

Thread: Join Performance - SQL Server 2005

  1. #1

    Thread Starter
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Join Performance - SQL Server 2005

    USING: SQL Server 2005

    I'm used to seeing Joins constructed using what I'll call the "Traditional" format:

    Code:
    SELECT *
    FROM tbl1
    INNER JOIN tbl2 
      ON tbl1.field1 = tbl2.field1
    INNER JOIN tbl3
      ON tbl2.field2 = tbl2.field2
    Apparently there is an "Alternative" format that allows you to nest the joins:
    Code:
    SELECT *
    FROM tbl1
    INNER JOIN tbl2 
        INNER JOIN tbl3
          ON tbl2.field2 = tbl2.field2
      ON tbl1.field1 = tbl2.field1
    Besides the maintenance ick factor that I encounter when ever I see this construct... does any one know if there is a performance difference between the two?

    I've got a query that is using this alternative construct, before I got in there deciphering what the joins really are, and re-arranging them to my liking, I'm curious to know if there would be any benefit to do so.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  2. #2
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Talking My 2 cents.

    I started off with Oracle 7.3 and for me the traditional format is

    SELECT * FROM TABLE1 A, TABLE2 B
    WHERE A.PRIMARY_KEY = B.FOREIGN_KEY



    I am still struggling to come to terms with the INNER JOIN syntax.
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  3. #3

    Thread Starter
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Join Performance - SQL Server 2005

    Yeah, I'm aware of that too... but that's not my concern... it's the nested joins (not just inner but I've got some LEFT ones that are done the same way...) I went ahead and re-arranged the query in question... no change in performance.... it would seem that my bottleneck seems to be the part of the join that has 128,000+ items on one side and 66,000+ items on the other....

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Re: Join Performance - SQL Server 2005

    I tried out that syntax in Oracle.
    For some reason syntax #2, illustrated by you fails in Oracle 9i.
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width