sql執行計劃是否改變
select SQL_ID,SQL_PLAN_HASH_VALUE,SQL_EXEC_START from V$ACTIVE_SESSION_HISTORY;
select PLAN_HASH_VALUE,FIRST_LOAD_TIME from v$sql where sql_id='bksyj647thx15'
select distinct SQL_ID,PLAN_HASH_VALUE,to_char(TIMESTAMP,'yyyymmdd hh24:mi:ss') TIMESTAMP
from dba_hist_sql_plan
where SQL_ID='3w2x40159yksh' order by TIMESTAMP;
歷史統計資訊變化:
select * from dba_TAB_STATS_HISTORY where TABLE_NAME='DWE_TASKS'; ----------統計資訊歷史
select OWNER,TABLE_NAME,LAST_ANALYZED,NUM_ROWS from dba_tables where TABLE_NAME='DWE_TASKS';
select OBJ# ,ROWCNT,BLKCNT,AVGRLN,SAMPLESIZE,ANALYZETIME,SAVTIME from sys.WRI$_OPTSTAT_TAB_HISTORY where obj#=3459727;
示plan_hash_value的執行計劃:
select * from table(DBMS_XPLAN.DISPLAY_AWR('3w2x40159yksh',format=>'all'));
select * from table(DBMS_XPLAN.DISPLAY_AWR('3w2x40159yksh','2105950411'));
select * from table(dbms_xplan.display_cursor('3w2x40159yksh'));
select PLAN_HASH_VALUE,FIRST_LOAD_TIME from v$sql where sql_id='bksyj647thx15'
select distinct SQL_ID,PLAN_HASH_VALUE,to_char(TIMESTAMP,'yyyymmdd hh24:mi:ss') TIMESTAMP
from dba_hist_sql_plan
where SQL_ID='3w2x40159yksh' order by TIMESTAMP;
歷史統計資訊變化:
select * from dba_TAB_STATS_HISTORY where TABLE_NAME='DWE_TASKS'; ----------統計資訊歷史
select OWNER,TABLE_NAME,LAST_ANALYZED,NUM_ROWS from dba_tables where TABLE_NAME='DWE_TASKS';
select OBJ# ,ROWCNT,BLKCNT,AVGRLN,SAMPLESIZE,ANALYZETIME,SAVTIME from sys.WRI$_OPTSTAT_TAB_HISTORY where obj#=3459727;
示plan_hash_value的執行計劃:
select * from table(DBMS_XPLAN.DISPLAY_AWR('3w2x40159yksh',format=>'all'));
select * from table(DBMS_XPLAN.DISPLAY_AWR('3w2x40159yksh','2105950411'));
select * from table(dbms_xplan.display_cursor('3w2x40159yksh'));
set lines 155
col execs for 999,999,999
col avg_etime for 999,999.999
col avg_lio for 999,999,999.9
col begin_interval_time for a30
col node for 99999
break on plan_hash_value on startup_time skip 1
select ss.snap_id, ss.instance_number node, begin_interval_time, sql_id, plan_hash_value,
nvl(executions_delta,0) execs,
(elapsed_time_delta/decode(nvl(executions_delta,0),0,1,executions_delta))/1000000 avg_etime,
(buffer_gets_delta/decode(nvl(buffer_gets_delta,0),0,1,executions_delta)) avg_lio
from DBA_HIST_SQLSTAT S, DBA_HIST_SNAPSHOT SS
where sql_id = nvl('&sql_id','4dqs2k5tynk61')
and ss.snap_id = S.snap_id
and ss.instance_number = S.instance_number
and executions_delta > 0
order by 1, 2, 3
/
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/20747382/viewspace-2132165/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 11g 改變SQL執行計劃SQL
- 利用coe_xfr_sql_profile 改變執行計劃SQL
- 使用hint改變執行計劃
- 加hint改變執行計劃訪問順序優化sql優化SQL
- Oracle 通過註釋改變執行計劃Oracle
- sql 執行計劃SQL
- sql執行計劃變更和刪除快取中執行計劃的方法SQL快取
- SQL優化案例-改變那些CBO無能為力的執行計劃(一)SQL優化
- 增加索引改變執行計劃——SQL優化之Everything is possible索引SQL優化
- 看執行計劃是否正確
- Oracle sql執行計劃OracleSQL
- SQL Server執行計劃SQLServer
- SQL的執行計劃SQL
- SQL執行計劃分析SQL
- SQL最佳化案例-改變那些CBO無能為力的執行計劃(一)SQL
- 檢視sql 執行計劃的歷史變更SQL
- 【sql調優之執行計劃】獲取執行計劃SQL
- 使用rownum改變執行計劃的一個典型情況
- 11g改變了DELETE語句的執行計劃delete
- SQLServer統計監控SQL執行計劃突變的方法SQLServer
- PostgreSQL執行計劃變化SQL
- oracle 執行計劃變更Oracle
- 獲取SQL執行計劃SQL
- SQL 執行計劃案例1SQL
- 剖析SQL Server執行計劃SQLServer
- 檢視sql執行計劃SQL
- 一條SQL語句的執行計劃變化探究SQL
- oracl10g以上通過v$sql_plan查詢sql的執行計劃是否發生變化SQL
- 恆等查詢條件改變執行計劃——SQL優化之Everything is PossibleSQL優化
- 【Oracle】如何檢視sql 執行計劃的歷史變更OracleSQL
- sql的執行計劃 詳解SQL
- sql執行計劃基本命令SQL
- SQL PROFILE修改固定執行計劃SQL
- 使用sql profile固定執行計劃SQL
- Oracle中檢視已執行sql的執行計劃OracleSQL
- 執行計劃變化的處理
- 如何檢視SQL的執行計劃SQL
- 檢視SQL的執行計劃方法SQL