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