1 - access("T2"."CUST_ID"="ITEM_1")
4 - filter("T3"."CUST_GENDER"='MALE')
5 - access(ROWID=ROWID)
7 - access("T3"."CUST_GENDER"='MALE')
9 - filter("T3"."CUST_GENDER"='FEMALE')
10 - access(ROWID=ROWID)
12 - access("T3"."CUST_GENDER"='FEMALE')
Statistics
----------------------------------------------------------
47 recursive calls
0 db block gets
111 consistent gets
0 physical reads
0 redo size
287 bytes sent via SQL*Net to client
404 bytes received via SQL*Net from client
1 SQL*Net roundtrips to/from client
8 sorts (memory)
0 sorts (disk)
0 rows processed
在Oracle 11gr2及其后续的版本中,即使由于在视图定义SQL语句中包含了集合运算符union all而导致 Oracle不能对其做视图合并,Oracle也不一定会把该视图的定义SQL语句当作一个整体来单独执行,因为此时Oracle还可能会对其做连接因式分解。这里需要注意的是,Oracle对包含union all的目标SQL做连接因式分解的前提条件是,连接因式分解后的等价改写SQL和原SQL在语义上完全等价,如果不能满足这一点,那么Oracle就不会做连接因式分解。
参考:
https://blogs.oracle.com/optimizer/entry/optimizer_transformations_join_factorization