Statistics
----------------------------------------------------------
457 recursive calls
0 db block gets
126 consistent gets
6 physical reads
0 redo size
335 bytes sent via SQL*Net to client
389 bytes received via SQL*Net from client
1 SQL*Net roundtrips to/from client
18 sorts (memory)
0 sorts (disk)
0 rows processed
注意到Id=3的执行步骤的Operation列的值为“VIEW”,对应Name列的值为“VIEW_JF”,这说明Oracle确实没有对范例SQL1中的视图VIEW_JF做视图合并,即Oracle现在还是将VIEW_JF的定义SQL语句当作一个整体来单独执行,所以此时表sales和customers分别做了两次哈希连接,然后Oracle将这两次哈希连接的连接结果做了union all合并后,才和视图VIEW_JF外部的表products再做一次哈希连接。
在Oracle 11gr2中再执行一次范例SQL1,看看在Oracle 11gr2中会如何处理该SQL:
SQL> select t1.prod_id,t1.prod_name
2 from products t1,view_jf
3 where t1.prod_id=view_jf.prod_id
4 and t1.prod_list_price>1000;
no rows selected
Execution Plan
----------------------------------------------------------
Plan hash value: 408077510
----------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
----------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 37586 | 2092K| 687 (1)| 00:00:09 | | |
|* 1 | HASH JOIN | | 37586 | 2092K| 687 (1)| 00:00:09 | | |
| 2 | VIEW | VW_JF_SET$7C24F767 | 17992 | 228K| 235 (1)| 00:00:03 | | |
| 3 | UNION-ALL | | | | | | | |
|* 4 | VIEW | index$_join$_004 | 8829 | 61803 | 118 (1)| 00:00:02 | | |
|* 5 | HASH JOIN | | | | | | | |
| 6 | BITMAP CONVERSION TO ROWIDS | | 8829 | 61803 | 1 (0)| 00:00:01 | | |
|* 7 | BITMAP INDEX SINGLE VALUE | CUSTOMERS_GENDER_BIX | | | | | | |
| 8 | INDEX FAST FULL SCAN | CUSTOMERS_PK | 8829 | 61803 | 145 (0)| 00:00:02 | | |
|* 9 | VIEW | index$_join$_006 | 9163 | 64141 | 118 (1)| 00:00:02 | | |
|* 10 | HASH JOIN | | | | | | | |
| 11 | BITMAP CONVERSION TO ROWIDS | | 9163 | 64141 | 1 (0)| 00:00:01 | | |
|* 12 | BITMAP INDEX SINGLE VALUE | CUSTOMERS_GENDER_BIX | | | | | | |
| 13 | INDEX FAST FULL SCAN | CUSTOMERS_PK | 9163 | 64141 | 145 (0)| 00:00:02 | | |
| 14 | NESTED LOOPS | | 19142 | 822K| 452 (0)| 00:00:06 | | |
| 15 | NESTED LOOPS | | 19142 | 822K| 452 (0)| 00:00:06 | | |
|* 16 | TABLE ACCESS FULL | PRODUCTS | 1 | 35 | 3 (0)| 00:00:01 | | |
| 17 | PARTITION RANGE ALL | | | | | | 1 | 28 |
| 18 | BITMAP CONVERSION TO ROWIDS | | | | | | | |
|* 19 | BITMAP INDEX SINGLE VALUE | SALES_PROD_BIX | | | | | 1 | 28 |
| 20 | TABLE ACCESS BY LOCAL INDEX ROWID| SALES | 12762 | 112K| 452 (0)| 00:00:06 | 1 | 1 |
----------------------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------