Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Joining views of Union All, Ora 7.3
This is a question about how far I can go with Union All views-- selecting
works, but what about joining?
I have a Union All view of two Employee tables (50K rows). It is very convenient for my data warehouse; the response time on 'selects' is just fine! Likewise, for a Union All view of two Person tables (50K rows). Complexity leaps up when I try to join the two (Union All) views! Any suggestions for Oracle 7.3 ?
[pasted from office intranet]
To understand what defaults the Optimizer takes when joining views of
unions, I created the views, Emp_eval and Per_eval (unions of Employee and
Person rows). Then I ran 'explain plan' on the JOIN of views, Emp_eval
and Per_eval.
It is shown below, after an analogous 'explain plan' for the JOIN of tables,
Employee and Person.
One conclusion is not surprising- - it is faster to join tables than Union-Views! Sticking with the Union-views raises the question though, "How can I tell the Optimizer to do better than a merge join and full-table scans ?"
Explained.
OPERATION OPTIONS OBJECT_NAME POSN
------------------------ -------------------- ---------------- ------
SELECT STATEMENT NESTED LOOPS 1 TABLE ACCESS FULL PERSON 1 TABLE ACCESS BY ROWID EMPLOYEE 2 INDEX RANGE SCAN EMPL_PIDM_IDX 1
5 rows selected.
Explained.
OPERATION OPTIONS OBJECT_NAME POSN
------------------------ -------------------- ---------------- ------
SELECT STATEMENT MERGE JOIN 1 SORT JOIN 1 VIEW PER_EVAL 1 UNION-ALL 1 TABLE ACCESS FULL PERSON 1 TABLE ACCESS FULL PERSON 2 SORT JOIN 2 VIEW EMP_EVAL 1 UNION-ALL 1 TABLE ACCESS FULL EMPLOYEE 1 TABLE ACCESS FULL EMPLOYEE 2
12 rows selected.
![]() |
![]() |