Pending Statistics

Starting with the 11g Release 1 (11.1), when gathering statistics, you have the option to automatically publish the statistics at the end of the gather operation (default behavior), or to have the new statistics saved as pending. Saving the new statistics as pending allows you to validate the new statistics and publish them only if they are satisfactory.

You can check whether or not the statistics will be automatically published as soon as they are gathered by checking the value of the PUBLISH attribute using the DBMS_STATS package:

Select dbms_stats.get_prefs(‘PUBLISH‘) publish from dual;

This query will return either TRUE or FALSE. TRUE indicates that the statistics will be published as and when they are gathered, while FALSE indicates that the statistics will be kept pending.

Note:

Published statistics are stored in data dictionary views, such as USER_TAB_STATISTICS and USER_IND_STATISTICS. Pending statistics are stored in views such as USER_TAB_PENDING_STATS and USER_IND_PENDING_STATS.

You can change the PUBLISH setting at either the schema or the table level. For example, to change the PUBLISH setting for the customers table in the SH schema, execute the statement:

Exec dbms_stats.set_table_prefs(‘SH‘, ‘CUSTOMERS‘, ‘PUBLISH‘, ‘false‘);

Subsequently, when you gather statistics on the customers table, the statistics will not be automatically published when the gather job completes. Instead, the newly gathered statistics will be stored in the USER_TAB_PENDING_STATS table.

By default, the optimizer uses the published statistics stored in the data dictionary views. If you want the optimizer to use the newly collected pending statistics, set the initialization parameter OPTIMIZER_USE_PENDING_STATISTICS to TRUE (the default value is FALSE), and run a workload against the table or schema:

alter session set optimizer_use_pending_statistics = TRUE;

The optimizer will use the pending statistics instead of the published statistics when compiling SQL statements.If the pending statistics are valid, they can be made public by executing the following statement:

Exec dbms_stats.publish_pending_stats(null, null);

You can also publish the pending statistics for a specific database object. For example, by using the following statement:

Exec dbms_stats.publish_pending_stats(‘SH‘,‘CUSTOMERS‘);

If you do not want to publish the pending statistics, delete them by executing the following statement:

Exec dbms_stats.delete_pending_stats(‘SH‘,‘CUSTOMERS‘);

You can export pending statistics using dbms_stats.export_pending_stats function. Exporting pending statistics to a test system enables you to run a full workload against the new statistics.

http://docs.oracle.com/cd/B28359_01/server.111/b28274/stats.htm#BEIEGBGI

时间: 2024-12-12 02:53:04

Pending Statistics的相关文章

11G新特性 -- Statistics Preferences

Statistics Preferences新特性可以实现对指定对象进行信息收集. 可以在table.schema.database.global级别设置statistics preference. 在database级别的statistics preference集会应用到数据库中的所有表:在global级别的statistics preference会应用到数据库中所有没有被设置statistics preference的表. preference集不同级别的优先级:table级别 > sc

所有表和动态视图列表(dict)

TABLE_NAME    COMMENTSDBA_CONS_COLUMNS    Information about accessible columns in constraint definitionsDBA_LOG_GROUP_COLUMNS    Information about columns in log group definitionsDBA_LOBS    Description of LOBs contained in all tablesDBA_CATALOG    A

ocp-410

QUESTION NO: 410? You executed the following commands: SQL> ALTER SESSION SET OPTIMIZER_USE_PENDING_STATISTICS = false; SQL> EXECUTE DBMS_STATS.SET_TABLE_PREFS('SH', 'CUSTOMERS', 'PUBLISH','false'); SQL> EXECUTE DBMS_STATS.GATHER_TABLE_STATS('SH'

我的oracle 健康检查报告

最近一直想用sql来生成oracle的健康检查报告,这样看起来一目了然,经过网上搜资料加自己整理终于算是成型了,部分结果如下图所示, 具体参考附件,恳请广大网友看看是否还有需要添加的地方. DB_healthcheck_by_lhr_ORADG11G_20150826160539.zip ORADG11G 数据库巡检报告 Copyright (c) 2015-2100 (http://blog.itpub.net/26736162) lhrbest. All rights reserved. 巡

[Hive - LanguageManual] Statistics in Hive

Statistics in Hive Statistics in Hive Motivation Scope Table and Partition Statistics Column Statistics Top K Statistics Implementation Usage Configuration Variables Newly Created Tables Existing Tables Examples Current Status (JIRA) This document de

URAL 1613. For Fans of Statistics(STL 数学啊 )

题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1613 1613. For Fans of Statistics Time limit: 1.0 second Memory limit: 64 MB Have you ever thought about how many people are transported by trams every year in a city with a ten-million population whe

使用Statistics命令查看Netapp存储实时性能统计数据

Cluster-mode下,引入了新的命令行工具,可以查看详细的存储系统性能指标,在进行存储系统诊断时候尤其有用. 注意:使用该命令需要进入高级模式,SSH登录存储CLI环境之后,执行命令:set  –privilege  advanced.参考下图1: 图1 命令使用方法 总览 可以使用命令statistics show-periodic查看当前系统实时的性能指标概览. 图2 样本收集 也可以使用命令statistics start |stop 收集一段时间内的性能参数,然后通过statist

Measuring PostgreSQL Checkpoint Statistics

Checkpoints can be a major drag on write-heavy PostgreSQL installations. The first step toward identifying issues in this area is to monitor how often they happen, which just got an easier to use interface added to the database recently. Checkpoints

Gerrit出现 Submitted, Merge Pending 和 Merge Conflict

一:Submitted, Merge Pending解决办法 产生原因: 例如: 原因1> (1)我提交了一个新的项目到Gerrit中,叫做commit1,这个commit1我没有submit到分支上 (2)这时我又在原来的编译器中提交了一个commit2 (3)此时我把commit2这条记录review掉,加2分,这时我点击submit合并代码时就会报这个错误.只有把commit1合并到分支上去                      后,commit2才能submit. 原因2> (1)