INNER JOIN vs Sub-Query (with where clause)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • islandfong
    New Member
    • Aug 2006
    • 15

    INNER JOIN vs Sub-Query (with where clause)

    Hi there,

    I am implementing a reporting database which manipulating a huge amount of data. I used a lot of join. Just wondering which one performs better between the two scenarios:
    1. INNER JOIN first then filter by the WHERE clause.
    2. Sub-query which WHERE clause first then INNER JOIN.
    Anybody have any recommendation?
  • pragatiswain
    Recognized Expert New Member
    • Nov 2006
    • 96

    #2
    Originally posted by islandfong
    Hi there,

    I am implementing a reporting database which manipulating a huge amount of data. I used a lot of join. Just wondering which one performs better between the two scenarios:
    1. INNER JOIN first then filter by the WHERE clause.
    2. Sub-query which WHERE clause first then INNER JOIN.
    Anybody have any recommendation?
    Subquery keeps the sql more clear.
    May be you have to see the plan, cost and execution time of both the queries and choose the better one.

    Comment

    • islandfong
      New Member
      • Aug 2006
      • 15

      #3
      As such, does it mean that there is not a general principle for using INNER JOIN or Sub-Query, at least there is not a clear cut line to say when is to use INNER JOIN and when is to use Sub-Query? But I do have this impression that the sub-query will surely add some slow down to the performance.

      Comment

      • suvam
        New Member
        • Nov 2006
        • 31

        #4
        Can u please write down the exact query ?
        Or U can do it yourself by identifying the driving table and where it is involved .

        Comment

        • birdready2fly
          New Member
          • Dec 2006
          • 6

          #5
          Originally posted by islandfong
          Hi there,

          I am implementing a reporting database which manipulating a huge amount of data. I used a lot of join. Just wondering which one performs better between the two scenarios:
          1. INNER JOIN first then filter by the WHERE clause.
          2. Sub-query which WHERE clause first then INNER JOIN.
          Anybody have any recommendation?
          sorry u r s question is not clear

          Comment

          Working...