1.2 读
SQL> select owner, index_name from t_test3;
2856 rows selected.
Execution Plan
----------------------------------------------------------
Plan hash value: 2878488296
-----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 2856 | 68544 | 22 (0)| 00:00:01 |
| 1 | TABLE ACCESS FULL| T_TEST3 | 2856 | 68544 | 22 (0)| 00:00:01 |
-----------------------------------------------------------------------------
Statistics
----------------------------------------------------------
407 recursive calls
32 db block gets
344 consistent gets
89 physical reads
0 redo size
103888 bytes sent via SQL*Net to client
2475 bytes received via SQL*Net from client
192 SQL*Net roundtrips to/from client
9 sorts (memory)
0 sorts (disk)
2856 rows processed
SQL> select owner, index_name from t_test3;
2856 rows selected.
Elapsed: 00:00:00.03
Execution Plan
----------------------------------------------------------
Plan hash value: 2878488296
-----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 2856 | 68544 | 22 (0)| 00:00:01 |
| 1 | TABLE ACCESS FULL| T_TEST3 | 2856 | 68544 | 22 (0)| 00:00:01 |
-----------------------------------------------------------------------------
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
276 consistent gets
0 physical reads
0 redo size
103888 bytes sent via SQL*Net to client
2475 bytes received via SQL*Net from client
192 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
2856 rows processed
SQL> select owner, table_name from t_test2
2 where owner = 'SYS';
718 rows selected.
Execution Plan
----------------------------------------------------------
Plan hash value: 1900296288
--------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)
| Time |
--------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 99 | 2178 | 10 (0)
| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| T_TEST2 | 99 | 2178 | 10 (0)
| 00:00:01 |
|* 2 | INDEX RANGE SCAN | T_TEST2_IDX1 | 99 | | 1 (0)
| 00:00:01 |
--------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("OWNER"='SYS')
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
145 consistent gets
0 physical reads
0 redo size
21690 bytes sent via SQL*Net to client
902 bytes received via SQL*Net from client
49 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
718 rows processed
SQL> select * from t_test1; --占用Buffer Cache
47582 rows selected.
Execution Plan
----------------------------------------------------------
Plan hash value: 1883417357
-----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 47582 | 3996K| 151 (2)| 00:00:02 |
| 1 | TABLE ACCESS FULL| T_TEST1 | 47582 | 3996K| 151 (2)| 00:00:02 |
-----------------------------------------------------------------------------
Statistics
----------------------------------------------------------
195 recursive calls
0 db block gets
3835 consistent gets
5 physical reads
0 redo size
5102247 bytes sent via SQL*Net to client
35277 bytes received via SQL*Net from client
3174 SQL*Net roundtrips to/from client
5 sorts (memory)
0 sorts (disk)
47582 rows processed
SQL> select owner, table_name from t_test2
2 where owner = 'SYS';
718 rows selected.
Execution Plan
----------------------------------------------------------
Plan hash value: 1900296288
--------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)
| Time |
--------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 99 | 2178 | 10 (0)
| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| T_TEST2 | 99 | 2178 | 10 (0)
| 00:00:01 |
|* 2 | INDEX RANGE SCAN | T_TEST2_IDX1 | 99 | | 1 (0)
| 00:00:01 |
--------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("OWNER"='SYS')
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
145 consistent gets
54 physical reads
0 redo size
21690 bytes sent via SQL*Net to client
902 bytes received via SQL*Net from client
49 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
718 rows processed
SQL> select * from t_test1 where owner='SYS' for update;
22858 rows selected.
Execution Plan
----------------------------------------------------------
Plan hash value: 3323170753
------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 22858 | 1919K| 151 (2)| 00:00:02 |
| 1 | FOR UPDATE | | | | | |
|* 2 | TABLE ACCESS FULL| T_TEST1 | 22858 | 1919K| 151 (2)| 00:00:02 |
------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("OWNER"='SYS')
Statistics
----------------------------------------------------------
44 recursive calls
23386 db block gets
2833 consistent gets
0 physical reads
5044956 redo size
2029221 bytes sent via SQL*Net to client
17138 bytes received via SQL*Net from client
1525 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
22858 rows processed
SQL> select object_name from t_test1 where object_id = 66;
OBJECT_NAME
------------------------------
I_SUPEROBJ1
SQL> update t_test1 set object_name = 'TEST' where object_id = 66;
1 row updated.
SQL> select object_name from t_test1 where object_id = 66;
OBJECT_NAME
------------------------------
I_SUPEROBJ1
Execution Plan
----------------------------------------------------------
Plan hash value: 1883417357
-----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 27 | 151 (2)| 00:00:02 |
|* 1 | TABLE ACCESS FULL| T_TEST1 | 1 | 27 | 151 (2)| 00:00:02 |
-----------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("OBJECT_ID"=66)
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
661 consistent gets
0 physical reads
108 redo size
423 bytes sent via SQL*Net to client
385 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
SQL> select object_name from t_test1
2 where object_id = 66;
Execution Plan
----------------------------------------------------------
Plan hash value: 2634232531
---------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
Time |
---------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 27 | 1 (0)|
00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| T_TEST1 | 1 | 27 | 1 (0)|
00:00:01 |
|* 2 | INDEX UNIQUE SCAN | T_TEST1_PK | 1 | | 1 (0)|
00:00:01 |
---------------------------------------------------------------------------------
SQL> select object_name from t_test1
2 where object_id < 66;
64 rows selected.
Execution Plan
----------------------------------------------------------
Plan hash value: 1635545337
---------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
Time |
---------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 57 | 1539 | 2 (0)|
00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| T_TEST1 | 57 | 1539 | 2 (0)|
00:00:01 |
|* 2 | INDEX RANGE SCAN | T_TEST1_PK | 57 | | 1 (0)|
00:00:01 |
---------------------------------------------------------------------------------
WHERE column = 'Value'
WHERE column like 'value%'
WHERE column between 'value1' and 'value2'
WHERE column in ('value1', 'value2')
WHERE column < 'value1'
WHERE column > 'value2'
SQL> select count(1) from t_test1 where object_id < 21314;
Execution Plan
----------------------------------------------------------
Plan hash value: 1586700957
---------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes| Cost (%CPU)| Time |
---------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1| 4| 24 (5)| 00:00:01|
| 1 | SORT AGGREGATE | | 1| 4| | |
|* 2 | INDEX FAST FULL SCAN| T_TEST1_PK | 18264| 73056| 24 (5)| 00:00:01|
---------------------------------------------------------------------------------
SQL> select /*+index(a t_test1_pk)*/count(1) from t_test1 a;
Execution Plan
----------------------------------------------------------
Plan hash value: 138350774
-----------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
-----------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 61 (2)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | | |
| 2 | INDEX FULL SCAN| T_TEST1_PK | 47582 | 61 (2)| 00:00:01 |
-----------------------------------------------------------------------