檢視Oracle中表的統計資訊

2021-06-19 01:33:27 字數 511 閱讀 1865

oracle資料庫在執行sql語句的時候,會根據統計資訊計算怎樣執行效能更優,當執行效能比自己想象的慢時,就有可能是統計資訊不新導致,檢視統計資訊常用的方式有如下三種:

1 檢視當前使用者下的統計資訊

select * from user_tab_statistics t where t.table_name=upper('l_dm_allot_detail');

2 檢視dba使用者下的統計資訊

select * from dba_tab_statistics t where t.table_name=upper('l_dm_allot_detail');

3 如果上面兩個都沒有查到,通常會查到的,就可以用下面這個查詢所有的統計資訊

select * from all_tab_statistics t where t.table_name=upper('l_dm_allot_detail');

其中的last_analyzed欄位就是最後收集統計資訊的時間,不夠新的話,可以請dba重新收集一下~!~

檢視索引的統計資訊

drop table t11 插入10萬條,c1資料分布均勻 create table t11 as select level c1,level c2 from dual connect by level 100000 插入2萬條c1 100,使該值數量很大,造成c1分布不均勻 insert int...

oracle檢視和更新統計表的資訊

在oem中檢視資料庫的會話時,發現有乙個會話的sql要10多秒 在pl sql中執行 sql按f5檢視這個sql的計畫,發現別的地方有 呼叫索引,oracle統計值檢視 select from dba tables where table name table 檢查一下欄位last analyzed...

檢視統計資訊 指令碼

我們要去 check 為啥過期了 看一下 為啥 統計資訊過期了,簡化了,自己考慮複雜情況 select from all tab modifications where table owner in select object owner from plan table and table name...