Oracle的自动统计信息不收集直方图的信息
发表于:2024-10-04 作者:千家信息网编辑
千家信息网最后更新 2024年10月04日,在oracle9i中,默认的统计信息收集是不收集直方图信息的,也就是说默认的MOTHOD_OPT模式为FOR ALL COLUMNS SIZE 1在10g开始,dbms_stats包中默认的METHO
千家信息网最后更新 2024年10月04日Oracle的自动统计信息不收集直方图的信息
在oracle9i中,默认的统计信息收集是不收集直方图信息的,也就是说默认的MOTHOD_OPT模式为FOR ALL COLUMNS SIZE 1
在10g开始,dbms_stats包中默认的METHOD_OPT做了调整,默认的METHOD_OPT值为FOR ALL COLUMNS SIZE AUTO
SQL> select * from v$version;BANNER----------------------Oracle Database for Linux: Version select dbms_stats.get_param('method_opt') from dual; DBMS_STATS.GET_PARAM('METHOD_OPT') ----------------------- FOR ALL COLUMNS SIZE AUTO
这就说明,从10g开始,统计信息收集中的直方图部分,收集与否是有oracle自从判断,从实际的使用来看,oracle的智能判断并不是100%正确,
oracle往往会大量的收集一些并不是必须的直方图信息,而有些直方图信息又会对查询造成不必要的影响
由于我们简单的对直方图进行删除后,oracle的自动统计信息又会重新收集,所以我们需要采取一些必要的方法,来规避这个问题
10g中:
- 解决方案
- 删除表的统计信息
- 手工收集标的统计信息,不收集直方图
- lock表的统计信息
- 创建JOB手工收集统计信息
11g中
在11g中,oracle对dbms_stats包添加了新功能,提供给我们进行修改,可以使用dbms_stats.set_table_prefs包
- 删除直方图信息:
dbms_stats.delete_column_stats procedure and setting the col_stat_type parameter to HISTOGRAM.
BEGIN dbms_stats.delete_column_stats(ownname=>'SH', tabname=>'SALES', colname=>'PROD_ID', col_stat_type=>'HISTOGRAM'); END; Use the new dbms_stats.set_table_pref procedure to set a specific value for the method_opt parameter for the table effected by this problem. The following value for the method_opt parameter tells Oracle to continue to collect histograms as usual on all of the columns in the SALES table except for the PROD_ID column, which should never have a histogram created on it. BEGIN dbms_stats.set_table_prefs('SH', 'SALES','METHOD_OPT', 'FOR ALL COLUMNS SIZE AUTO, FOR COLUMNS SIZE 1 PROD_ID'); END;/
The auto stats gathering job or your own statistics gathering commands will now use the table preference you set when it gathers statistics on this table and will no longer create a histogram on the ID column.
信息
直方图
统计
手工
必要
也就是
也就是说
实际
新功能
方案
方法
智能
模式
解决方案
部分
问题
影响
查询
调整
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
网络安全大赛人员名单
初中毕业计算机网络技术怎么样
分类标签数据库设计
数据库程序设计体验
普陀区节能软件开发服务生产厂家
软件开发工具归纳
服务器显卡可远程使用吗
网络安全知识教育主题班会总结
网络技术部新年对联
公安部对网络安全最新要求
数据库主键怎么用代码设置
数据库停车场管理系统
数据库导数据到hdfs的命令
某银行软件开发中心拖欠工资
全球网络安全资讯榜
分离了两次数据库文件怎么办
提现数据库代码设计
访问网络安全策略
表示软件开发过程的图片
水利网络安全工作总结
联想服务器主机有外音吗
方舟服务器维护
手机网络服务器不稳定如何解决
提高5g网络技术
联通校园网服务器未响应
aria数据库分支
随着信息网络技术
监控软件开发包
信息网络安全制度试题及答案
快速复制一张表 数据库