【TUNE_ORACLE】檢視錶,列和索引的統計資訊SQL參考

Attack_on_Jager發表於2021-07-29

實驗環境

搭建平臺:VMware Workstation

OS:RHEL 6.10

Grid&DB:Oracle 11.2.0.4


SQL參考

--單表的統計資訊

select owner, table_name, num_rows, blocks, avg_row_len

  from dba_tables

 where owner = 'aaa'

   and table_name = 'bbb';


--表和列的統計資訊

select a.column_name,

       b.num_rows,

       a.num_nulls,

       a.num_distinct cardinality,

       round(a.num_distinct / b.num_rows * 100, 2) selectivity,

       a.hisogram,

       a.num_buckets

  from dba_tab_col_statistics a, dba_tables b

 where a.owner = b.owner

   and a.table_name = b.table_name

   and a.owner = 'aaa'

   and a.table_name = 'bbb';


--索引的統計資訊

select blevel, leaf_blocks, clustering_factor, status

  from dba_indexes

 where owner = 'aaa';

   and index_name = 'bbb';


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69992972/viewspace-2784114/,如需轉載,請註明出處,否則將追究法律責任。

相關文章