1.4.7 信息统计工具dbms_stats.gather_table_stats 2

本文介绍Oracle数据库中如何使用dbms_stats包来收集表统计信息的方法,包括不同method_opt选项的作用及如何通过特定参数来定制统计过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

method_opt:决定histograms信息是怎样被统计的.method_opt的取值如下(默认值为FOR ALL COLUMNS SIZE AUTO):
for all columns:统计所有列的histograms.
for all indexed columns:统计所有indexed列的histograms.
for all hidden columns:统计你看不到列的histograms
for columns <list> SIZE <N> | REPEAT | AUTO | SKEWONLY:统计指定列的histograms.N的取值范围[1,254];
REPEAT上次统计过的histograms;AUTO由oracle决定N的大小;SKEWONLY multiple end-points with the same value which is what we define by "there is skew in thedata
degree:决定并行度.默认值为null.
granularity:Granularity of statistics to collect ,only pertinent if the table is partitioned.
cascade:是收集索引的信息.默认为FALSE.
stattab:指定要存储统计信息的表,statid如果多个表的统计信息存储在同一个stattab中用于进行区分.statown存储统计信息表的拥有者.以上三个参数若不指定,统计信息会直接更新到数据字典.
no_invalidate: Does not invalidate the dependent cursors if set to TRUE. The procedure invalidates the dependent cursors immediately if set to FALSE.
force:即使表锁住了也收集统计信息.
操作步骤
步骤 1    以oracle用户登录操作系统。
步骤 2    登录数据库。   
:~> sqlplus / as sysdba;
步骤 3    使用dbms_stats分析统计
--分析表
SQL> exec dbms_stats.gather_table_stats(ownname => 'lbi_ls_basic',tabname => 't_l_acct_sum_po_sum_d',estimate_percent => 10,method_opt=> 'for all indexed columns') ;
----结束
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值