PLSQL_统计信息系列02_统计信息的对象

20150505 Created By BaoXinjian

一摘要


有三种类型的对象统计信息: 表统计、列统计和索引统计

对每个烈性来说,有有紫烈,表或索引级别的统计,分区级别的统计和子分区级别的统计

1. 统计信息类型

(1). 表的统计信息

(2). 列的统计信息

(3). 直方图

(4). 扩展的统计信息

(5). 索引的统计信息

2. 建立测试案例

--创建表
create table t
as
select rownum as id,
       round(dbms_random.normal*1000) as val1,
       100+round(ln(rownum/3.25+2)) as val2,
       100+round(ln(rownum/3.25+2)) as val3,
       dbms_random.string('p',250) as pad
from all_objects
where rownum <= 1000
order by dbms_random.value;

update t set val1 = null where val1 < 0;

alter table t add constraint t_pk primary key (id);

create index t_val1_i on t(val1);

create index t_val2_i on t(val2);

--对表进行分析
begin
dbms_stats.gather_table_stats(
       ownname          => user,
       tabname          => 'T',
       estimate_percent =>100,
       method_opt       => 'for all columns size skewonly',
       cascade          => TRUE
);
end;

 

二、表的统计信息


 

 

select num_rows, blocks, empty_blocks, avg_space, chain_cnt, avg_row_len
  from dba_tab_statistics
 where table_name = 'T'

 

 

 

 

 

三、列的统计信息


 

 

 

 

四、直方图


 

 

 

 

五、扩展的统计信息


 

 

 

 

六、索引的统计信息


 

 

 

 

 

 

 

 

Thanks and Regards

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值