oracle12 保存动态采样,Oracle 12c Dynamic statistics与 之前版本Dynamic Sampling动态采样的区别...

01fac6460a22031b8af8da5848698a70.png

动态统计信息(Dynamic Statistics)是一个新的概念。在11g的数据库,我们知道的动态采样(dynamic sampling)是在优化sql语句之前收集最基本的对象的统计信息。

12c优化器会判断当前有效的统计信息是否足够,否则使用动态统计信息。动态统计信息是一个持久的统计信息,会存储在统计仓储中,因此可能会被其他的查询语句使用。在12c中,

优化器会判断是否动态统计信息是有用的,是否动态采样是正确的方法,并能自动决定动态采样的级别。

动态统计信息 :

During the compilation of a SQL statement, the optimizer decides whether to use dynamic statistics by considering whether the available statistics are sufficient to generate a good execution plan. If the available statistics are not enough, then dynamic statistics are used. Dynamic statistics are persistent and may be used by other queries. One type of dynamic statistic is the information gathered by dynamic sampling. Traditionally, dynamic sampling would automatically occur only if one or more of the tables in the query did not have statistics. Dynamic sampling gathered basic statistics on these tables before optimizing the statement. Now, the optimizer automatically decides if dynamic statistics are useful for all SQL statements and if dynamic sampling is the right approach.

动态采样:

If it is, the optimizer also determines what dynamic sampling level is used

Dynamic statistics are automatically used when the optimizer deems it necessary and the resulting statistics are persistent in the statistics repository making them available to other queries.

“the optimizer automatically decides if dynamic statistics are useful for all SQL statements and if dynamic sampling is the right approach.If it is, the optimizer also determines what dynamic sampling level is used.”

动态统计信息的级别说明,可以参照下面的文档:

http://docs.oracle.com/database/121/TGSQL/tgsql_astat.htm#TGSQL451

这个新的特性是缺省的行为。 这个特征在12c上主要体现在优化器更加智能,动态统计信息可以持久化影响后来的sql执行上,这些都是11g所没有的,。

收集动态统计信息,可以通过设置OPTIMIZER_DYNAMIC_SAMPLING=0禁止掉。谢谢。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值