optimizer_dynamic_sampling引數的理解
OPTIMIZER_DYNAMIC_SAMPLING
Parameter type
Integer
Default value
If OPTIMIZER_FEATURES_ENABLE is set to 9.2.0 or higher, then 1
If OPTIMIZER_FEATURES_ENABLE is set to 9.0.1 or lower, then 0
Parameter class
Dynamic: ALTER SESSION, ALTER SYSTEM
Range of values
0 to 10
OPTIMIZER_DYNAMIC_SAMPLING controls the level of dynamic sampling performed by the optimizer.
根據不同的optimizer_dynamic_sampling級別而不同,他總共有10個級別,分別如下:
· Level 0: Do not use dynamic sampling.
· Level 1: The number of blocks sampled is the default number of dynamic sampling blocks (32).
· Level 2: The number of blocks sampled is 2 times the default number of dynamic sampling blocks.
· Level 3: The number of blocks sampled is 4 times the default number of dynamic sampling blocks.
· Level 4: The number of blocks sampled is 8 times the default number of dynamic sampling blocks.
· Level 5: The number of blocks sampled is 16 times the default number of dynamic sampling blocks.
· Level 6: The number of blocks sampled is 32 times the default number of dynamic sampling blocks.
· Level 7: The number of blocks sampled is 64 times the default number of dynamic sampling blocks.
· Level 8: The number of blocks sampled is 128 times the default number of dynamic sampling blocks.
· Level 9: The number of blocks sampled is 256 times the default number of dynamic sampling blocks.
· Level 10: Read all blocks in the table.
下面測試一把,
> show parameter OPTIMIZER_DYNAMIC_SAMPLING;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
optimizer_dynamic_sampling integer 2
> col table_name for a20
> create table test as select object_id a from dba_objects;
Table created.
--此表剛建好還沒有做分析
> select table_name,num_rows from user_tables where table_name='TEST';
TABLE_NAME NUM_ROWS
-------------------- ----------
TEST
--執行SQL,掃描此表
> select count(*) from test;
COUNT(*)
----------
49931
--還是沒有收集到統計資訊
> select table_name,num_rows from user_tables where table_name='TEST';
TABLE_NAME NUM_ROWS
-------------------- ----------
TEST
> set autot on;
> select count(*) from test;
COUNT(*)
----------
49931
Execution Plan
----------------------------------------------------------
Plan hash value: 1950795681
-------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
-------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 19 (6)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | | |
| 2 | TABLE ACCESS FULL| TEST | 47534 | 19 (6)| 00:00:01 |
-------------------------------------------------------------------
Note
-----
- dynamic sampling used for this statement
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
79 consistent gets
0 physical reads
0 redo size
413 bytes sent via SQL*Net to client
396 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
--發現有動態收集統計資訊
總結:ORACLE在遇到沒有統計資料的物件時,會很聰明地計算出增加的編譯時間是否值得,如果值得,oracle會對物件資料塊的一部分進行抽樣來估算統計資料。動態收集的統計資訊不會儲存在資料字典中。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/271283/viewspace-1003367/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- jmeter 引數理解JMeter
- linux,mtime引數的理解Linux
- 深入理解mysql引數MySql
- JavaScript引數傳遞的深入理解JavaScript
- 引數FAST_START_MTTR_TARGET的理解AST
- 1.5 - Numpy的方法中,axis引數的理解
- linux find depth引數理解Linux
- find命令-mtime引數理解
- 深入理解JVM(三)——配置引數JVM
- flume 寫往hdfs引數理解分析
- 初始化引數OPEN_CURSORS的理解加深
- v$session中LAST_CALL_ET引數的理解SessionAST
- 帶你深入理解傳遞引數
- Request 接收引數亂碼原理解析
- 理解spread運算子與rest引數REST
- 淺談對python pandas中 inplace 引數的理解Python
- 你都理解建立執行緒池的引數嗎?執行緒
- innodb_flush_log_at_trx_commit引數的直白理解MIT
- 深入理解RabbitMQ中的prefetch_count引數MQ
- JavaScript引數傳遞中值和引用的一種理解JavaScript
- 隱含引數_minimum_giga_scn的理解
- RAC中對DB引數檔案的簡單理解
- Oracle一些引數的理解 cursor_sharingOracle
- 【Data Pump】理解expdp中的ESTIMATE和ESTIMATE_ONLY引數
- 2、從引數估計的角度理解邏輯迴歸邏輯迴歸
- F5負載均衡器的重要引數理解負載
- 對 “C語言指標變數作為函式引數” 的個人理解C語言指標變數函式
- 通過原始碼理解 Java 執行緒池的核心引數原始碼Java執行緒
- LevelDB原始碼分析:理解Slice實現 - 高效的LevelDB引數物件原始碼物件
- 深度理解Oracle10g中UNDO_RETENTION引數的使用Oracle
- 9i,10g 優化器動態取樣級別引數 -- optimizer_dynamic_sampling (統計優化)優化
- kettle 引數——變數引數和常量引數變數
- C#中的值引數,引用引數及輸出引數C#
- iOS可變引數(不定引數)的用法iOS
- 關於 groutine 喚醒中 skipframes 引數不理解
- JAVAScript柯里化、部分應用引數終極理解JavaScript
- [譯] ES6:理解引數預設值的實現細節
- 個人理解emulateJSON作用 與java後臺介面引數的關係JSONJava