设为首页 加入收藏

TOP

使用DBMS_STATS来收集统计信息(二)
2014-11-24 03:16:03 来源: 作者: 【 】 浏览:8
Tags:使用 DBMS_STATS 收集 统计 信息
ain index, Oracle calls the statistics collection method in the statistics type if you analyze the column or domain index.

只有存储在字典视图中的统计信息,才会被优化器使用。

当我们收集表、列或者索引的统计信息时,如果数据字典中已经包含有统计信息,oracle会将已有信息进行更新。同时oracle也会使当前解析的与更新对象相关的sql语句无效,以便可以使用信息的统计信息。在远程主机中执行的分布式语句,则在oracle下次解析时才会使用心得统计信息。

当我们将某列或者域索引与某一统计类别管理时,oracle会在分析该列或者域索引是调用该统计类别下的统计收集方法。

missing statistics

When statistics do not exist on schema objects, the optimizer uses the following default values.
当统计信息不存在是,oracle会使用如下的默认统计信息。
Tables
Statistic Default Value Used by Optimizer
Cardinality 100 rows
Avg. row len 20 bytes
No. of blocks 100
Remote cardinality 2000 rows
Remote average row length 100 bytes
Indexes
Statistic Default Value Used by Optimizer
Levels 1
Leaf blocks 25
Leaf blocks/key 1
Data blocks/key 1
Distinct keys 100
Clustering factor 800 (8*no. of blocks)

Analyze vs DBMS_STATS

The following is a quick overview of the two.

Analyze The only method available for collecting statistics in Oracle 8.0 and lower.(ORACLE 8之前仅有的统计信息收集方式)ANALYZE can only run serially(只可以串行执行).ANALYZE cannot overwrite or delete certain types of statistics that where generated by DBMS_STATS (不可以覆盖DBMS_STATS生成的部分统计信息) .ANALYZE calculates global statistics for partitioned tables and indexes instead of gathering them directly. This can lead to inaccuracies for some statistics, such as the number of distinct values. (ANALYZE针对分区表和索引计算全局统计信息,而不是直接针对整张表进行统计分析,这可能造成不正确的统计信息,例如distinct value的取值) For partitioned tables and indexes, ANALYZE gathers statistics for the individual partitions and then calculates the global statistics from the partition statistics. (对于分区表,ANALYZE收集每个分区的统计信息,然后根据各个分区的信息计算出全局统计信息)For composite partitioning, ANALYZE gathers statistics for the subpartitions and then calculates the partition statistics and global statistics from the subpartition statistics. (对于组合分区表,ANALYZE收集每个子分区的统计信息,然后据此计算各个分区和全局的统计信息) ANALYZE can gather additional information that is not used by the optimizer, such as information about chained rows and the structural integrity of indexes, tables, and clusters. DBMS_STATS does not gather this information. (ANALYZE 会收集某些与优化器无关的信息,例如chainrow,索引、表和cluster的结构完整性,DBMS_STATS不会收集这些信息)No easy way of knowing which tables or how much data within the tables have changed. The DBA would generally re-analyze all of their tables on a semi-regular basis. (没有办法知道哪些表或者表中的哪些数据发生了变化,dba通常会依据一定的规则重新收集所有标的统计信息)

DBMS_STATS Only available for Oracle 8i and higher.(在oracle8之后才可用)Statistics can be generated to a statistics table and can then be imported or exported between databases and re-loaded into the data dictionary at any time. This allows the DBA to experiment with various statistics.(统计信息可以被导出导入,方便了DBA的使用)DBMS_STATS routines have the option to run via parallel query or operate serially(可以并行或者串行执行).Can gather statistics for sub-partitions or partitions.(可以收集分区和子分区的统计信息)Certain DDL commands (ie. create index) automatically generate statistics, therefore eliminating the need to generate statistics explicitly after DDL command.(某些DDL语句可以自动收集统计信息)DBMS_STATS does not generate information about chained rows and the structural integrity of segments.(不会收集chainrow和段结构有效性的统计信息)The DBA can set a particular table, a whole schema or the entire database to be automatically monitored when a modification occurs. When ena

首页 上一页 1 2 3 4 5 6 7 下一页 尾页 2/11/11
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇各类数据库通过sql查询表字段的注.. 下一篇为过程或函数指定了过多的参数

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·C++中智能指针的性能 (2025-12-25 03:49:29)
·如何用智能指针实现c (2025-12-25 03:49:27)
·如何在 C 语言中管理 (2025-12-25 03:20:14)
·C语言和内存管理有什 (2025-12-25 03:20:11)
·为什么C语言从不被淘 (2025-12-25 03:20:08)