CLUSTERING_FACTOR影響執行計劃
SCOTT@ prod1>select count(*) from t2;
COUNT(*)
----------
72594
SCOTT@ prod1>select num_rows,blocks from user_tables;
NUM_ROWS BLOCKS
---------- ----------
72594 1059
SCOTT@ prod1>select 72594/1059 from dual;
72594/1059
----------
68.5495751
SCOTT@ prod1>drop table t2;
Table dropped.
SCOTT@ prod1>create table t2 as select * from dba_objects where rownum<69;
Table created.
SCOTT@ prod1>analyze table t2 compute statistics;
Table analyzed.
SCOTT@ prod1>insert into t2 select * from t2;
8832 rows created.
SCOTT@ prod1>commit;
SCOTT@ prod1>create index ind_t2 on t2(object_id);
Index created.
SCOTT@ prod1>analyze table t2 compute statistics for all indexed columns;
Table analyzed.
SCOTT@ prod1>analyze table t2 compute statistics;
Table analyzed.
SCOTT@ prod1>select table_name,num_rows,blocks from user_tables;
T2 17664 244
SCOTT@ prod1>select * from t2 where object_id=11;
256 rows selected.
Execution Plan
----------------------------------------------------------
Plan hash value: 1513984157
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 256 | 20224 | 68 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| T2 | 256 | 20224 | 68 (0)| 00:00:01 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("OBJECT_ID"=11)
Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
266 consistent gets
0 physical reads
0 redo size
5155 bytes sent via SQL*Net to client
606 bytes received via SQL*Net from client
19 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
256 rows processed
Table created.
SCOTT@ prod1>create index ind_t3 on t3(object_id);
Index created.
SCOTT@ prod1>analyze table t3 compute statistics;
Table analyzed.
SCOTT@ prod1>select index_name,table_name,clustering_factor from user_indexes where table_name = 'T3';
INDEX_NAME TABLE_NAME CLUSTERING_FACTOR
------------------------------ ------------------------------ -----------------
IND_T3 T3 202
SCOTT@ prod1>select table_name,num_rows,blocks from user_tables where table_name = 'T2';
TABLE_NAME NUM_ROWS BLOCKS
------------------------------ ---------- ----------
T2 17664 244
SCOTT@ prod1>select table_name,num_rows,blocks from user_tables where table_name = 'T3';
TABLE_NAME NUM_ROWS BLOCKS
------------------------------ ---------- ----------
T3 17664 212
SCOTT@ prod1>
SCOTT@ prod1>
SCOTT@ prod1>set autotrace traceonly;
SCOTT@ prod1>select * from t3 where object_id=11;
256 rows selected.
Execution Plan
----------------------------------------------------------
Plan hash value: 1203691736
--------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 256 | 20224 | 4 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| T3 | 256 | 20224 | 4 (0)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | IND_T3 | 256 | | 1 (0)| 00:00:01 |
--------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("OBJECT_ID"=11)
Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
41 consistent gets
0 physical reads
0 redo size
24259 bytes sent via SQL*Net to client
606 bytes received via SQL*Net from client
19 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
256 rows processed
SCOTT@ prod1>select /*+ full(t3) */ * from t3 where object_id = 11;
256 rows selected.
Execution Plan
----------------------------------------------------------
Plan hash value: 4161002650
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 256 | 20224 | 59 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| T3 | 256 | 20224 | 59 (0)| 00:00:01 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("OBJECT_ID"=11)
Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
222 consistent gets
0 physical reads
0 redo size
5155 bytes sent via SQL*Net to client
606 bytes received via SQL*Net from client
19 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
256 rows processed
COUNT(*)
----------
72594
SCOTT@ prod1>select num_rows,blocks from user_tables;
NUM_ROWS BLOCKS
---------- ----------
72594 1059
SCOTT@ prod1>select 72594/1059 from dual;
72594/1059
----------
68.5495751
SCOTT@ prod1>drop table t2;
Table dropped.
SCOTT@ prod1>create table t2 as select * from dba_objects where rownum<69;
Table created.
SCOTT@ prod1>analyze table t2 compute statistics;
Table analyzed.
SCOTT@ prod1>insert into t2 select * from t2;
8832 rows created.
SCOTT@ prod1>commit;
SCOTT@ prod1>create index ind_t2 on t2(object_id);
Index created.
SCOTT@ prod1>analyze table t2 compute statistics for all indexed columns;
Table analyzed.
SCOTT@ prod1>analyze table t2 compute statistics;
Table analyzed.
T2 17664 244
SCOTT@ prod1>select * from t2 where object_id=11;
256 rows selected.
Execution Plan
----------------------------------------------------------
Plan hash value: 1513984157
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 256 | 20224 | 68 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| T2 | 256 | 20224 | 68 (0)| 00:00:01 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("OBJECT_ID"=11)
Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
266 consistent gets
0 physical reads
0 redo size
5155 bytes sent via SQL*Net to client
606 bytes received via SQL*Net from client
19 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
256 rows processed
SCOTT@ prod1>select /* + index(t2) */ * from t2 where object_id=11;
256 rows selected.
Execution Plan
----------------------------------------------------------
Plan hash value: 1513984157
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 256 | 20224 | 68 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| T2 | 256 | 20224 | 68 (0)| 00:00:01 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("OBJECT_ID"=11)
Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
266 consistent gets
0 physical reads
0 redo size
5155 bytes sent via SQL*Net to client
606 bytes received via SQL*Net from client
19 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
256 rows processed
SCOTT@ prod1>select index_name,table_name,clustering_factor from user_indexes where table_name = 'T2';
INDEX_NAME TABLE_NAME CLUSTERING_FACTOR
------------------------------ ------------------------------ -----------------
IND_T2 T2 12708
SCOTT@ prod1>create table t3 as select * from t2 order by object_id;256 rows selected.
Execution Plan
----------------------------------------------------------
Plan hash value: 1513984157
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 256 | 20224 | 68 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| T2 | 256 | 20224 | 68 (0)| 00:00:01 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("OBJECT_ID"=11)
Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
266 consistent gets
0 physical reads
0 redo size
5155 bytes sent via SQL*Net to client
606 bytes received via SQL*Net from client
19 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
256 rows processed
SCOTT@ prod1>select index_name,table_name,clustering_factor from user_indexes where table_name = 'T2';
INDEX_NAME TABLE_NAME CLUSTERING_FACTOR
------------------------------ ------------------------------ -----------------
IND_T2 T2 12708
Table created.
SCOTT@ prod1>create index ind_t3 on t3(object_id);
Index created.
SCOTT@ prod1>analyze table t3 compute statistics;
Table analyzed.
SCOTT@ prod1>select index_name,table_name,clustering_factor from user_indexes where table_name = 'T3';
INDEX_NAME TABLE_NAME CLUSTERING_FACTOR
------------------------------ ------------------------------ -----------------
IND_T3 T3 202
SCOTT@ prod1>select table_name,num_rows,blocks from user_tables where table_name = 'T2';
TABLE_NAME NUM_ROWS BLOCKS
------------------------------ ---------- ----------
T2 17664 244
SCOTT@ prod1>select table_name,num_rows,blocks from user_tables where table_name = 'T3';
TABLE_NAME NUM_ROWS BLOCKS
------------------------------ ---------- ----------
T3 17664 212
SCOTT@ prod1>
SCOTT@ prod1>
SCOTT@ prod1>set autotrace traceonly;
SCOTT@ prod1>select * from t3 where object_id=11;
256 rows selected.
Execution Plan
----------------------------------------------------------
Plan hash value: 1203691736
--------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 256 | 20224 | 4 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| T3 | 256 | 20224 | 4 (0)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | IND_T3 | 256 | | 1 (0)| 00:00:01 |
--------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("OBJECT_ID"=11)
Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
41 consistent gets
0 physical reads
0 redo size
24259 bytes sent via SQL*Net to client
606 bytes received via SQL*Net from client
19 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
256 rows processed
256 rows selected.
Execution Plan
----------------------------------------------------------
Plan hash value: 4161002650
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 256 | 20224 | 59 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| T3 | 256 | 20224 | 59 (0)| 00:00:01 |
--------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("OBJECT_ID"=11)
Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
222 consistent gets
0 physical reads
0 redo size
5155 bytes sent via SQL*Net to client
606 bytes received via SQL*Net from client
19 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
256 rows processed
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29108064/viewspace-2125505/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- cluster factor對執行計劃的影響
- 索引及排序對執行計劃的影響索引排序
- oracle cardinality對於執行計劃的影響Oracle
- not-null約束對執行計劃的影響Null
- 不等號影響執行計劃的相關實驗
- Oracle優化案例-統計資訊對執行計劃的影響(十三)Oracle優化
- 【CURSOR】Oracle繫結變數、執行計劃對遊標的影響Oracle變數
- 實驗-資料分佈對執行計劃的影響.txt
- _complex_view_merging對執行計劃的影響View
- 引數Optimizer_index_cost_adj 對執行計劃的影響Index
- 再說索引與Null值對於Hints及執行計劃的影響索引Null
- 收集統計資訊中的no_invalidate選項對執行計劃的影響
- 影響執行計劃之oracle sql baseline與sql profile之互動OracleSQL
- 執行計劃-1:獲取執行計劃
- 執行計劃
- MySQL選用可重複讀之前一定要想到的事情(執行計劃影響)MySql
- 分析執行計劃優化SQLORACLE的執行計劃(轉)優化SQLOracle
- oracle sqlprofile 固定執行計劃,並遷移執行計劃OracleSQL
- 【sql調優之執行計劃】獲取執行計劃SQL
- db_file_multiblock_read_count引數對block讀取和執行計劃的影響BloC
- 表挪動儲存空間後,對之上的sql的執行計劃的影響的探究SQL
- SYBASE執行計劃
- MySQL 執行計劃MySql
- MySQL執行計劃MySql
- sql 執行計劃SQL
- ORACLE執行計劃Oracle
- Hint 組合執行步驟 - 分開執行, 互不影響
- 【執行計劃】Oracle獲取執行計劃的幾種方法Oracle
- 【Oracle】-【索引-HINT,執行計劃】-帶HINT的索引執行計劃Oracle索引
- 分析執行計劃最佳化SQLORACLE的執行計劃(轉)SQLOracle
- 淺析影響專案執行的因素
- CSS3實現動畫不會影響主執行緒,JS實現動畫會影響主執行緒CSSS3動畫執行緒JS
- 【PG執行計劃】Postgresql資料庫執行計劃統計資訊簡述SQL資料庫
- oracle 固定執行計劃Oracle
- Oracle sql執行計劃OracleSQL
- explain執行計劃分析AI
- mysql執行計劃explainMySqlAI
- mysql explain 執行計劃MySqlAI