Welcome to Oracle PL SQL Performance Tuning and Optimization. At Oracle PL SQL Performance Tuning and Optimization talk about SQL RBO Tuning - Joining Three or More Tables

Thursday, September 13

SQL RBO Tuning - Joining Three or More Tables

SQL RBO Tuning - Joining Three or More Tables : If three tables are being joined, try to select the intersection table as the driving table. The intersection table is the table that has the most dependencies on it. In the following example, the EMP table represents the intersection between the LOCATION table and the CATEGORY table. This first SELECT:

SELECT   . . .
FROM     location L,
         category C,
         emp E
  WHERE  E.emp_no BETWEEN 1000 AND 2000
    AND  E.cat_no =  C.cat_no
    AND  E.locn   =  L.locn

is more efficient under Rule Based Optimization than this next example:

SELECT     . . .
 FROM      emp E,
           location L,
           category C
    WHERE  E.cat_no =  C.cat_no
      AND  E.locn   =  L.locn
      AND  E.emp_no BETWEEN 1000 AND 2000

0 comments:

Post a Comment

Copyright © 2013 Oracle PL SQL Performance Tuning and Optimization | Oracle PL SQL Performance Tuning and Optimization