Table select statement performance

  • shubham.saxena67

    Default port

    Points: 1488

    Dear Friends,

    I am having two tables TB_PERSON_P and TB_PERSON_R

    both having a common column R_ID

    now we can write two query:

    select R_ID from TB_PERSON_P P,TB_PERSON_R R where P.R_ID=R.R_ID

    and

    Select R_ID from TB_PERSON_P P join TB_PERSON_R on P.R_ID=R.R_ID

    which would be faster among these two statement?

    Thanks!!

  • Robert Murphy UK1

    Default port

    Points: 1455

    They will perform the same (same execution plan), the only difference is one uses the ANSI syntax and the other the old style SQL Server / Sybase syntax.

    Robert Murphy, Microsoft MCITP (Database Administrator 2008) and MCAD Certified
  • Robert Murphy UK1

    Default port

    Points: 1455

    ...and I would recommend specifying the join type for readability if using the improved ANSI joins:

    INNER JOIN (default)

    RIGHT OUTER JOIN

    LEFT OUTER JOIN etc etc

    Robert Murphy, Microsoft MCITP (Database Administrator 2008) and MCAD Certified

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply