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

Pending Statistics的更多相关文章

  1. 11G新特性 -- Statistics Preferences

    Statistics Preferences新特性可以实现对指定对象进行信息收集. 可以在table.schema.database.global级别设置statistics preference. ...

  2. 1Z0-050

    QUESTION 13 View the Exhibit.Examine the following command that is executed for the TRANSPORT table ...

  3. oracle_hc.sql

    select event,count(1) from gv$session group by event order by 2;exec dbms_workload_repository.create ...

  4. Oracle 所有字典

    select * from DBA_CONS_COLUMNS ; ---Information about accessible columns in constraint definitions s ...

  5. SPA 介绍

    SQL 性能分析器(SPA)工具概览 作为 Oracle Real Application Testing 选件/特性,这篇文章将提供一个关于 SQL 性能分析器(SPA)工具的简要概览.这是此系列的 ...

  6. 我的oracle 健康检查报告

    最近一直想用sql来生成oracle的健康检查报告,这样看起来一目了然,经过网上搜资料加自己整理终于算是成型了,部分结果如下图所示, 具体参考附件,恳请广大网友看看是否还有需要添加的地方. DB_he ...

  7. oracle之三存储库及顾问框架

    AWR存储库及顾问框架(PPT-I-349-360) 14.1 Oracle数据库采样ASH和AWR. 1) ASH(Active Session History) ASH收集的是活动会话的样本数据, ...

  8. [Hive - LanguageManual] Statistics in Hive

    Statistics in Hive Statistics in Hive Motivation Scope Table and Partition Statistics Column Statist ...

  9. ABBA BABA statistics

    The ABBA BABA statistics are used to detect and quantify an excess of shared derived alleles, which ...

随机推荐

  1. [BS-12] JSON的基础知识--百科

    JSON的基础知识--百科 http://baike.baidu.com/view/136475.htm

  2. C# Excel写入

    基本思路,就是using Microsoft.Office.Interop.Excel;然后启动excel来处理 创建excel文件,代码如下: if (File.Exists(path)) { re ...

  3. Java集合 List,Set,Map

      一.List:.有顺序以线性方式存储,可以存放重复对象 线程安全方法:List list = Collections.synchronizedList(new LinkedList(...)); ...

  4. Trace-导出已有的服务器端跟踪

    跟踪(Trace)常被我们用来检查性能问题.通常我们会有针对CPU.Duration.Reads的创建跟踪定义,这一类的脚本一般不会包含太多的事件和列,筛选条件也相对简单.假如某一天你使用GUI定义了 ...

  5. [算法]A General Polygon Clipping Library

    A General Polygon Clipping Library Version 2.32    http://www.cs.man.ac.uk/~toby/alan/software/gpc.h ...

  6. hive DDL

    官网地址:https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL https://cwiki.apache.org/co ...

  7. Win7 OpenCV 3.0.0 VS2013 环境配置

    参考资料:http://jingyan.baidu.com/article/75ab0bcbee4b47d6864db2fc.html 注: x86 x64 这些根据自己的系统以及需求而定, 这里就不 ...

  8. spring security之httpSecurity使用示例

    如果在HttpSecurity中配置需要authenticate(),则如果没有登陆,或没有相关权限,则会无法访问 2017-01-02 23:39:32.027 DEBUG 10396 --- [n ...

  9. Java基础之在窗口中绘图——绘制曲线(CurveApplet 1)

    Applet程序. 定义自由曲线的类有两个,其中一个定义二次曲线,另一个定义三次曲线.这些自由曲线是用一系列线段定义的参数化曲线.二次曲线段用方程定义,方程包含独立变量x的平方.三次曲线也用方程定义, ...

  10. 学习OpenCV——粒子滤波(网上两篇文章总结)

    粒子滤波的理论实在是太美妙了,用一组不同权重的随机状态来逼近复杂的概率密度函数.其再非线性.非高斯系统中具有优良的特性.opencv给出了一个实现,但是没有给出范例,学习过程中发现网络上也找不到.le ...