已归录

如下语句查询了表的总行数,每个列的基数值,可选性和直方图信息。

set lines 200;
set pages 200;
select a.column_name,
       b.num_rows,
       a.num_distinct Cardinality,
       round(a.num_distinct / b.num_rows * 100, 2) selectivity,
       a.histogram,
       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='&INPUT_USER_NAME'
and a.table_name='&INPUT_TABLE_NAME';
-- By 许望(RHCA、OCM、VCP)
最后修改:2020 年 05 月 25 日 02 : 34 PM
如果觉得我的文章对你有用,请随意赞赏