dynamic sampling

简介: dynamic sampling dynamic sampling对于我们来说其实不算太陌生,从9i r2开始,dynamic sampling其实已经不动声色地融入到数据库中了。

dynamic sampling

dynamic sampling对于我们来说其实不算太陌生,从9i r2开始,dynamic sampling其实已经不动声色地融入到数据库中了。
我们经常会碰到由于一些表没有分析导致执行计划错误的情况,但是dynamic sampling的出现一定程度的减少了错误的产生。dynamic sampling针对没有分析过的表可以采样估计表的选择性,对于生产正确的执行计划有一定的帮助。
 
dynamic sampling分为10个级别,从0-10,由参数optimizer_dynamic_sampling控制
 
下面是取自" Performance Tuning Guide and Reference "的对10种级别的定义
 
  • Level 0: Do not use dynamic sampling.
  • Level 1: Sample all tables that have not been analyzed if the following criteria are met: (1) there is at least 1 unanalyzed table in the query; (2) this unanalyzed table is joined to another table or appears in a subquery or non-mergeable view; (3) this unanalyzed table has no indexes; (4) this unanalyzed table has more blocks than the number of blocks that would be used for dynamic sampling of this table. The number of blocks sampled is the default number of dynamic sampling blocks (32).
  • Level 2: Apply dynamic sampling to all unanalyzed tables. The number of blocks sampled is the default number of dynamic sampling blocks.
  • Level 3: Apply dynamic sampling to all tables that meet Level 2 criteria, plus all tables for which standard selectivity estimation used a guess for some predicate that is a potential dynamic sampling predicate. The number of blocks sampled is the default number of dynamic sampling blocks.
  • Level 4: Apply dynamic sampling to all tables that meet Level 3 criteria, plus all tables that have single-table predicates that reference 2 or more columns. The number of blocks sampled is the default number of dynamic sampling blocks.
  • Level 5: Apply dynamic sampling to all tables that meet the Level 4 criteria using 2 times the default number of dynamic sampling blocks.
  • Level 6: Apply dynamic sampling to all tables that meet the Level 5 criteria using 4 times the default number of dynamic sampling blocks.
  • Level 7: Apply dynamic sampling to all tables that meet the Level 6 criteria using 8 times the default number of dynamic sampling blocks.
  • Level 8: Apply dynamic sampling to all tables that meet the Level 7 criteria using 32 times the default number of dynamic sampling blocks.
  • Level 9: Apply dynamic sampling to all tables that meet the Level 8 criteria using 128 times the default number of dynamic sampling blocks.
  • Level 10: Apply dynamic sampling to all tables that meet the Level 9 criteria using all blocks in the table.
dynamic_sampling hint的级别定义如下
 
  • Level 0: Do not use dynamic sampling.
  • Level 1: The number of blocks sampled is the default number of dynamic sampling blocks (32).
  • Level 2: The number of blocks sampled is 2 times the default number of dynamic sampling blocks.
  • Level 3: The number of blocks sampled is 4 times the default number of dynamic sampling blocks.
  • Level 4: The number of blocks sampled is 8 times the default number of dynamic sampling blocks.
  • Level 5: The number of blocks sampled is 16 times the default number of dynamic sampling blocks.
  • Level 6: The number of blocks sampled is 32 times the default number of dynamic sampling blocks.
  • Level 7: The number of blocks sampled is 64 times the default number of dynamic sampling blocks.
  • Level 8: The number of blocks sampled is 128 times the default number of dynamic sampling blocks.
  • Level 9: The number of blocks sampled is 256 times the default number of dynamic sampling blocks.
  • Level 10: Read all blocks in the table.
相关文章
|
1月前
|
SQL
Adaptive Statistics
Adaptive Statistics
14 0
|
1月前
|
Oracle 关系型数据库
Adaptive Query Optimization
Adaptive Query Optimization
17 4
|
8月前
|
算法 计算机视觉 知识图谱
ACL2022:A Simple yet Effective Relation Information Guided Approach for Few-Shot Relation Extraction
少样本关系提取旨在通过在每个关系中使用几个标记的例子进行训练来预测句子中一对实体的关系。最近的一些工作引入了关系信息
76 0
|
8月前
|
自然语言处理 Java 计算机视觉
ACL2023 - AMPERE: AMR-Aware Prefix for Generation-Based Event Argument Extraction Model
事件论元抽取(EAE)识别给定事件的事件论元及其特定角色。最近在基于生成的EAE模型方面取得的进展显示出了与基于分类的模型相比的良好性能和可推广性
117 0
|
8月前
|
机器学习/深度学习 自然语言处理 算法
Joint Information Extraction with Cross-Task and Cross-Instance High-Order Modeling 论文解读
先前的信息抽取(IE)工作通常独立地预测不同的任务和实例(例如,事件触发词、实体、角色、关系),而忽略了它们的相互作用,导致模型效率低下。
57 0
|
SQL 移动开发 算法
New Dynamic Programming Algorithm for the Generation of Optimal Bushy Join Trees
MySQL无疑是现在开源关系型数据库系统的霸主,在DBEngine的最新排名中仍然稳居第2位,与第3位SQL Server的积分差距并不算小,可以说是最受欢迎,使用度最高的数据库系统,这一点看看有多少新型数据库要兼容MySQL的协议和语法就知道了。
264 0
New Dynamic Programming Algorithm for the Generation of Optimal Bushy Join Trees
|
SQL 监控 算法
Adaptive Execution of Compiled Queries 论文解读
本篇是TUM的内存数据库HyPer针对compile-based执行框架的改进。其中涉及到HyPer的动态编译和并行执行框架 动态编译文章的结尾提到了编译执行系统存在的2个问题,其中之一就是:不可控的编译时间。
423 0
Adaptive Execution of Compiled Queries 论文解读