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. iptables常用操作

    1.iptables服务重启 service iptables restart 2.保存iptables规则 iptables-save > ~/iptables.save 3.恢复iptabl ...

  2. PHP中用下划线开头的变量含义

    http://blog.csdn.net/zlking02/article/details/6752256 一个下划线是私有变量以及私有方法两个下划线是PHP内置变量. https://segment ...

  3. js访sleep方法

    function sleep(n) { var start = new Date().getTime(); while (true) if (new Date().getTime() - start ...

  4. RFS_窗口或区域之间的切换

    1.  测试用例描述 [前置条件]: 1. 已经登录系统 [测试步骤]: 1. 验证登录成功 2. 选择[用户管理]菜单 3. 打开[新增用户]页面 4. 输入必填字段,点击[Submit]按钮 [预 ...

  5. 利用WebService发布图片文件

    服务器端: 1.新建一个Asp.net空网站RGImageServer. 2.新建一个WebService项目ImageService,项目新增文件ImageService.asmx,添加方法GetT ...

  6. git 查看、创建、删除 本地,远程 分支

    1. 查看远程分支 git branch -rorigin/master 2. 查看本地分支 git branch *master 注:以*开头指明现在所在的本地分支 3. 查看本地分支和远程分支 g ...

  7. EF Code First DataAnnotations

    Key EF框架要求每个实体必须有主键字段,他需要根据这个主键字段跟踪实体.CodeFirst方法在创建实体时,也必须指定主键字段,默认情况下属性被命名为ID.id或者[ClassName]Id,将映 ...

  8. 移动端<head>头部 常用<meta>标签

    <!DOCTYPE html><html lang = ""><head> <title></title> <me ...

  9. Python:安装mssql模块功能,并实现与sqlserver连接、查询

    由于我系统是x64系统,所以下载python2.7 x64.下载地址:https://www.python.org/downloads/release/python-2712/, 经过测试发现这个版本 ...

  10. OLTP与OLAP的差异

    OLTP与OLAP的差异 系统类型 OLTP(在线交易系统) OLAP(联机分析系统),DW(数据仓库) 数据来源 操作数据,OLTP通常是原始性数据源 联合型数据:OLAP数据来源于其他OLTP系统 ...