baseline依賴SQL文字還是SQL ID?
create table t1 (col1 number);
select /*+ find_me */ * from t1 where col1 = 3;
select /*+ find_me */ * from t1 where col1 = 3;
select /*+ find_me */ * from t1 where col1 = 3;
select /*+ find_me */ * from T1 where col1 = 3;
select /*+ find_me */ * from t1 where col1 = 3
select sql_id from v$sql where sql_text like '%find_me%' and sql_text not like '%v$sql%';
ctjxy06k6d3mx
aqk191u7r1jcg
3tgvczhfa699z
g2paq9587m72x
set num 20
select sql_id, hash_value, old_hash_value, exact_matching_signature, force_matching_signature
from v$sql
where sql_id IN ('ctjxy06k6d3mx','aqk191u7r1jcg','3tgvczhfa699z','g2paq9587m72x');
SQL_ID HASH_VALUE OLD_HASH_VALUE EXACT_MATCHING_SIGNATURE FORCE_MATCHING_SIGNATURE
-------------------------- -------------------- -------------------- ------------------------ ------------------------
ctjxy06k6d3mx 2758184573 2948577380 4456219368825610060 12886847737592201784
aqk191u7r1jcg 2406532495 1523185690 4456219368825610060 12886847737592201784
3tgvczhfa699z 480453951 921579551 4456219368825610060 12886847737592201784
g2paq9587m72x 1350147165 2036140407 4456219368825610060 12886847737592201784
declare
l_op pls_integer;
begin
l_op := dbms_spm.load_plans_from_cursor_cache(sql_id =>'ctjxy06k6d3mx');
l_op := dbms_spm.load_plans_from_cursor_cache(sql_id =>'aqk191u7r1jcg');
l_op := dbms_spm.load_plans_from_cursor_cache(sql_id =>'3tgvczhfa699z');
l_op := dbms_spm.load_plans_from_cursor_cache(sql_id =>'g2paq9587m72x');
end;
/
select to_char(signature), sql_text from dba_sql_plan_baselines where signature = 4456219368825610060 order by created desc;
TO_CHAR(SIGNATURE) SQL_TEXT
-------------------- --------------------------------------------------------------------------------
4456219368825610060 select /*+ find_me */ * from t1 where col1 = 3
SQL> select /*+ find_me */
2 *
3 from t1
4 where col1 = 3;
no rows selected
SQL> select * from table(dbms_xplan.display_cursor());
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
SQL_ID cr6chh7p7vvzt, child number 0
-------------------------------------
select /*+ find_me */ * from t1 where col1 = 3
Plan hash value: 3617692013
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 2 (100)| |
|* 1 | TABLE ACCESS FULL| T1 | 1 | 13 | 2 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("COL1"=3)
Note
-----
- SQL plan baseline SQL_PLAN_3vpxbwzn11rucdbd90e8e used for this statement
23 rows selected.
SQL> select /*+ find_me */
2 *
3 from t1
4 where col1 = 3;
no rows selected
SQL> select * from table(dbms_xplan.display_cursor());
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
SQL_ID 8j52h3wtgvu3n, child number 0
-------------------------------------
select /*+ find_me */ * from t1 where col1 = 3
Plan hash value: 3617692013
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 2 (100)| |
|* 1 | TABLE ACCESS FULL| T1 | 1 | 13 | 2 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("COL1"=3)
Note
-----
- SQL plan baseline SQL_PLAN_3vpxbwzn11rucdbd90e8e used for this statement
23 rows selected.
SQL> SELECT /*+ find_me */ *
2 FROM t1
3 WHERE col1 = 3;
no rows selected
SQL> select * from table(dbms_xplan.display_cursor());
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
SQL_ID 894k8t6nu8kbf, child number 0
-------------------------------------
SELECT /*+ find_me */ * FROM t1 WHERE col1 = 3
Plan hash value: 3617692013
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 2 (100)| |
|* 1 | TABLE ACCESS FULL| T1 | 1 | 13 | 2 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("COL1"=3)
Note
-----
- SQL plan baseline SQL_PLAN_3vpxbwzn11rucdbd90e8e used for this statement
23 rows selected.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22034023/viewspace-708024/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- sql pan baselineSQL
- Oracle SQL baselineOracleSQL
- ASP.NET的快取依賴機制-SQL快取依賴篇ASP.NET快取SQL
- SQL如何實現查詢節點依賴SQL
- sql_plan_baselineSQL
- sql plan baseline(二)SQL
- sql plan baseline使用心得SQL
- Oracle SQL Plan Baseline 學習OracleSQL
- sql:delete if exists還是drop if exists?SQLdelete
- oracle 11g sql plan baseline(3)演化baselineOracleSQL
- 依賴注入?依賴注入是如何實現解耦的?依賴注入解耦
- 什麼是依賴注入依賴注入
- baseline固定SQL執行計劃SQL
- 依賴引入 | Android依賴引入史上最全攻略Android
- 使用IDEA模組之間依賴找不到依賴類Idea
- 學習SQL 快取依賴的筆記(比較初級)SQL快取筆記
- SQL Server 2005實現資料庫快取依賴SQLServer資料庫快取
- android引入依賴,合集Android
- 使用sql*plus編輯sql文字SQL
- 11203測試sql baselineSQL
- SQL BASELINE修改固定執行計劃SQL
- zt_sql baseline_sql profile_sql outline修改固定執行計劃SQL
- SQL -- 使用聯結還是子查詢?SQL
- oracle 11g sql plan baseline(4)使用baseline覆蓋hintOracleSQL
- idea檢視依賴樹Idea
- Android 依賴管理簡介Android
- Android 依賴注入框架RoboGuiceAndroid依賴注入框架GUI
- 什麼是依賴倒置原則
- 依賴管理和依賴範圍
- sql profile和baseline的協作關係SQL
- zt_oracle11g sql baseline與sql execution plan執行計劃OracleSQL
- 依賴
- NoSQL 還是 SQL ?這一篇講清楚SQL
- 複雜查詢還是直接寫sql吧SQL
- 依賴倒置(DIP)與依賴注入(DI)依賴注入
- 影響執行計劃之oracle sql baseline與sql profile之互動OracleSQL
- oracle 11g sql plan baseline(5)baseline的問題和補充OracleSQL
- jQuery Validate依賴項介紹jQuery