analyze表或索引会不会产生Histogram信息?

下面做实验来验证,analyze表或索引的时候,会不会产生Histogram信息.

数据库版本: 9.2.0.4.0

操作系统平台: Solaris 9

SQL> desc test
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 NAME                                               VARCHAR2(20)
 CHENFENG                                           DATE

SQL> analyze table test delete statistics;

Table analyzed.

只分析表:

SQL> analyze table test compute statistics for table;

Table analyzed.

SQL> select count(*) from dba_tab_histograms where table_name = 'TEST';

  COUNT(*)
----------
         0 

---不产生Histogram信息!

SQL> analyze table test delete statistics;

Table analyzed.

SQL>  select count(*) from dba_tab_histograms where table_name = 'TEST';

  COUNT(*)
----------
         0

只分析索引:
SQL> analyze table test compute statistics for all indexes;

Table analyzed.

SQL> select count(*) from dba_tab_histograms where table_name = 'TEST';

  COUNT(*)
----------
         0

---不产生Histogram信息!

SQL> analyze table test delete statistics;

Table analyzed.

SQL> select count(*) from dba_tab_histograms where table_name = 'TEST';

  COUNT(*)
----------
         0

对索引列进行分析:

SQL>  analyze table test compute statistics for table for all columns;

Table analyzed.

SQL> select count(*) from dba_tab_histograms where table_name = 'TEST';          

  COUNT(*)
----------
        21

---产生Histogram信息.

SQL>  analyze table test delete  statistics;

Table analyzed.

SQL> select count(*) from dba_tab_histograms where table_name = 'TEST';

  COUNT(*)
----------
         0

默认的COMPUTE STATISTICS对表进行分析:

SQL> analyze table test compute statistics;

Table analyzed.

SQL> select count(*) from dba_tab_histograms where table_name = 'TEST';

  COUNT(*)
----------
         4
---产生Histogram信息. 

从上面的试验,关于Analyze和Histogram,我们可以得到如下结论:

 只要对列进行分析的话,就会产生Histogram信息。而光对表,索引进行分析的话,则不会产生Histogram,而且默认的COMPUTE | ESTIMATE STATISTICS; 对表进行分析是会产生Histogram的,因为它默认的会加上for all columns

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值