- dynamic sampling used for this statement
19 rows selected
我们可以看到,在这里
Oracle对两个表都执行了全表扫描。
下面再看另外一句:
[sql]
[lubinsu@localhost ~]$ sqlplus lubinsu/lubinsu
SQL*Plus: Release 10.2.0.1.0 - Production on Sat May 25 12:06:14 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> set timing on
SQL> set autotrace traceonly
SQL> UPDATE t_test_1 a
2 SET a.object_type =
3 (SELECT i.object_type FROM t_test_2 i WHERE i.object_id2 = a.object_id);
49894 rows updated.
Elapsed: 00:00:02.41
Execution Plan
----------------------------------------------------------
Plan hash value: 2786494037
--------------------------------------------------------------------------------
-----------------
| Id | Operation | Name | Rows | Bytes | Cost (
%CPU)| Time |
--------------------------------------------------------------------------------
-----------------
| 0 | UPDATE STATEMENT | | 64296 | 1506K| 137
(3)| 00:00:02 |
| 1 | UPDATE | T_TEST_1 | | |
| |
| 2 | TABLE ACCESS FULL | T_TEST_1 | 64296 | 1506K| 137
(3)| 00:00:02 |
| 3 | TABLE ACCESS BY INDEX ROWID| T_TEST_2 | 603 | 14472 | 6
(0)| 00:00:01 |
|* 4 | INDEX RANGE SCAN | IND_T_TEST_2_ID2 | 241 | | 1
(0)| 00:00:01 |
--------------------------------------------------------------------------------
-----------------
Predicate Information (identified by operation id):
---------------------------------------------------
4 - access("I"."OBJECT_ID2"=:B1)
Note
-----
- dynamic sampling used for this statement
Statistics
----------------------------------------------------------
448 recursive calls
101974 db block gets
100838 consistent gets
110 physical reads
23668060 redo size
668 bytes sent via SQL*Net to client
658 bytes received via SQL*Net from client
4 SQL*Net roundtrips to/from client
11 sorts (memory)
0 sorts (disk)
49894 rows processed
[sql]
--排版不好,整理下:
[sql]
SQL> set linesize 200
SQL> /
49894 rows updated.
Elapsed: 00:00:03.98
Execution Plan
----------------------------------------------------------
Plan hash value: 2786494037
-------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------------------------
| 0 | UPDATE STATEMENT | | 64296 | 1506K| 137 (3)| 00:00:02 |
| 1 | UPDATE | T_TEST_1 | | | | |
| 2 | TABLE ACCESS FULL | T_TEST_1 | 64296 | 1506K| 137 (3)| 00:00:02 |
| 3 | TABLE ACCESS BY INDEX ROWID| T_TEST_2 | 603 | 14472 | 6 (0)| 00:00:01 |