ptimizer_dynamic_sampling設定為4的作用。
SQL> create table test (lang varchar2(20),city varchar2(20));
表已建立。
已用時間: 00: 00: 00.06
SQL> begin
2 for i in 1..10000 loop
3 insert into test values('china','china');
4 commit;
5 end loop;
6 end;
7 /
PL/SQL 過程已成功完成。
已用時間: 00: 00: 01.20
SQL> begin
2 for i in 1..10000 loop
3 insert into test values('english','english');
4 commit;
5 end loop;
6 end;
7 /
PL/SQL 過程已成功完成。
已用時間: 00: 00: 01.22
SQL> BEGIN
2 DBMS_STATS.GATHER_TABLE_STATS(OWNNAME => 'NCSI',
3 TABNAME => 'TEST',
4 ESTIMATE_PERCENT => 100,
5 METHOD_OPT => 'FOR ALL COLUMNS SIZE AUTO',
6 CASCADE => TRUE);
7 END;
8 /
PL/SQL 過程已成功完成。
已用時間: 00: 00: 00.32
SQL> select count(*) from test;
COUNT(*)
----------
20000
已用時間: 00: 00: 00.01
SQL> alter session set optimizer_dynamic_sampling=2;
會話已更改。
已用時間: 00: 00: 00.00
SQL> select * from test where lang='china' and city='english';
未選定行
已用時間: 00: 00: 00.01
SQL> select * from table(dbms_xplan.display_cursor(null,null,'basic note'));
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------
--------
EXPLAINED SQL STATEMENT:
------------------------
select * from test where lang='china' and city='english'
Plan hash value: 217508114
----------------------------------
| Id | Operation | Name |
----------------------------------
| 0 | SELECT STATEMENT | |
| 1 | TABLE ACCESS FULL| TEST |
----------------------------------
已選擇13行。
已用時間: 00: 00: 00.06
SQL> select * from test where lang='china' and city='english';
未選定行
已用時間: 00: 00: 00.00
SQL> select * from table(dbms_xplan.display_cursor(null,null,'all note'));
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------
--------
SQL_ID bbp7t90twf7p6, child number 0
-------------------------------------
select * from test where lang='china' and city='english'
Plan hash value: 217508114
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 14 (100)| |
|* 1 | TABLE ACCESS FULL| TEST | 5000 | 70000 | 14 (0)| 00:00:01 |
--------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
1 - SEL$1 /
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter(("LANG"='china' AND "CITY"='english'))
Column Projection Information (identified by operation id):
-----------------------------------------------------------
1 - "LANG"[VARCHAR2,20], "CITY"[VARCHAR2,20]
已選擇28行。
已用時間: 00: 00: 00.05
SQL> alter session set optimizer_dynamic_sampling=4;
會話已更改。
已用時間: 00: 00: 00.00
SQL> select * from test where lang='china' and city='english';
未選定行
已用時間: 00: 00: 00.02
SQL> select * from table(dbms_xplan.display_cursor(null,null,'all note'));
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------
--------
SQL_ID bbp7t90twf7p6, child number 1
-------------------------------------
select * from test where lang='china' and city='english'
Plan hash value: 217508114
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 14 (100)| |
|* 1 | TABLE ACCESS FULL| TEST | 1 | 14 | 14 (0)| 00:00:01 |
--------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
1 - SEL$1 /
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter(("LANG"='china' AND "CITY"='english'))
Column Projection Information (identified by operation id):
-----------------------------------------------------------
1 - "LANG"[VARCHAR2,20], "CITY"[VARCHAR2,20]
Note
-----
- dynamic sampling used for this statement
已選擇32行。
已用時間: 00: 00: 00.05
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22034023/viewspace-666545/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- linux 設定tab為4個空格Linux
- 路由設定代理IP的三大作用路由
- Android之Service設定android:process作用Android
- QTableWidget設定行高不起作用QT
- webpack4 Mode的預設設定Web
- Cookie 作用,互動過程解析,設定,獲取,刪除,生效時間的設定Cookie
- 方法的作用和定義
- Fresco的圖片SimpleDraweeView設定ScaleType不起作用的問題View
- Azure Function host.json 設定不起作用FunctionJSON
- 伺服器防火牆的作用是什麼?如何設定?伺服器防火牆
- 網站的TDK該怎麼設定?它有什麼作用?網站
- Fedora怎麼設定DVD為yum源?Fedora設定DVD為yum源的方法
- cookie的值可以設定為中文嗎?為什麼?如果可以怎麼設定?Cookie
- vue專案 設定scrollTop不起作用 總結Vue
- 怎樣設定CRM目標?有什麼作用?
- win10電腦 tls安全設定怎麼設定為預設設定Win10TLS
- 為Tomcat設定自己的管理賬號Tomcat
- 自定義滑鼠設定-中鍵設定為後退
- idea怎麼設定為中文2022 intellijidea最新設定為中文方法介紹IdeaIntelliJ
- 在git中設定.gitignore忽略規則不起作用的解決方法Git
- 華為手機怎麼設定來電影片?華為EMUI來電影片秀的設定教程UI
- 設定 Teredo 伺服器,預設為:伺服器
- 預設值的作用域
- log4j的基本使用和引數設定
- win10的foxmail怎麼設定為預設郵件程式 win10設定foxmail為預設郵件程式方法Win10AI
- Linux下設定VSCode為預設的文字編輯器LinuxVSCode
- Linux中chmod命令的定義及作用!Linux
- Python Lambda表示式的作用及定義Python
- CDN加速快取的定義與作用快取
- 為Docker容器設定http代理DockerHTTP
- antd ProTable 設定padding為0padding
- 小米路由器4Q怎麼設定?用手機設定小米路由器4Q的方法教程圖解路由器圖解
- 【Spring註解驅動開發】使用@Scope註解設定元件的作用域Spring元件
- 華為手機怎麼設定來電視訊?華為EMUI來電視訊秀的設定教程UI
- Notepad++設定為預設應用程式
- AWS DocumentDB 如何設定為預設 write concern
- MacOS如何為指定的應用設定語言Mac
- Androidx為Fragment中的按鈕設定監聽AndroidFragment
- Mac終端程式背景如何設定為透明的?Mac