ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Oracle优化(11)

Oracle优化(11)

原创 Linux操作系统 作者:tangtao94 时间:2010-07-15 08:23:08 0 删除 编辑

计算对象统计数据的各种方法
analyze table line_items compute statistics /* this calculation computes full statistics for the line_items table and all of its index*/
或
analyze table line_items compute statistics
for all indexed columns size 254 /* this calculation computes
histograms for all columns of all indexes on the line_items table.
ths size 254 is for the number of buckets utilized during the calculation
of the disctribution of data */
或
analyze table line_items estimate statistics
sample size 20 percent /* this calculation estimates statistics for the line_items table
and all of its indexes using a sample size of 20 percent of the number of rows int the table */

DBMS_UTILITY程序包中的analyse_schema过程允许对整个模式进行统计计算。
一下的SQL生成SQL的脚本建立了另一个对表明以字母A起头的所有表自动分析BENCHMARK模式的脚本。
set echo off
set feedback off
set verify off
set pagesize 0
spool analyze_script.sql
/* Run query for script. file generation */
select 'analyze table ' ||owner||'.'||table_name|| ' estimate statistics sample size 20 percent;' from dba_tables
where owner in (BENCHMARK) and table_name like 'A%';
spool off
@analyze_script.sql
set echo onset feedback on
set verify on
set pagesize 23

"作业安全"提示
1、在导出一个或多个对象时,应确保STATISTICS参数设置为NONE,使得导入操作不会覆盖以计算出的统计数据。
2、重新建立索引时,需要重新分析这些索引,不这样可能导致性能下降。
3、估算操作在计算对象的新的统计数据之前不能完全删除老的统计数据,建议先删除原来的统计数据,然后重更新计算。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/518171/viewspace-668035/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: Oracle优化(10)
下一篇: Oracle优化(12)
请登录后发表评论 登录
全部评论

注册时间:2010-07-06

  • 博文量
    33
  • 访问量
    242821