77

执行计划中DYNAMIC_SAMPLING显示更高的级别

 5 years ago
source link: http://www.dboracle.com/archivers/执行计划中dynamic_sampling显示更高的级别.html?amp%3Butm_medium=referral
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

查看执行计划的时候,发现一个有意思的问题,这里Note显示dynamic sampling used for this statement (level=6)。查看了一下系统默认的参数optimizer_dynamic_sampling,当前设置的是2。而不是6,那么为什么它会自动从2变成6呢?

Iv2EjyA.png!web

通过查MOS,发现这种行为是11.2引入的。因为在以前的数据库版本中例如,当查询中的表非常大时,默认值2使用动态采样信息而导致产生错误的执行计划。通过此增强功能,可以在某些条件下更改动态值,例如大表和开并行的情况下。根据查询表的大小自动调整级别。但是这仅仅适用于并行查询。这其实对数据仓库和大型数据库来说是非常好的一个调整。但是我查了一下MOS,这个也会引发一些问题。如果你并发程度比较高的话,执行动态采样的查询会引起多个并行的slave进程获取exclusive lock,从而导致相应的性能下降。产生很多的:“cursor: pin S wait on X”。
那么解决办法是设置_fix_control,将7452863关闭,alter system set “_fix_control”=’7452863:OFF’。或者关闭并行操作。
具体可以参考文档:High Waits for ‘cursor: pin S wait on X’ due to Dynamic Sampling Against Parallel Queries (文档 ID 2006145.1)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK