DEFAULT 并行度

有群友在问table的Degree=default是什么意思,具体我记不清了,于是上网下了一下,找到了老张的一篇文章

from http://tomszrp.itpub.net/post/11835/525898

Oracle并行度tips
作者 tomszrp 22:52 | Permalink 静态链接网址 | Comments 最新回复 (0) | Trackback 引用 (1) | 解决方案

与单个操作关联的并行执行服务器的数量称为并行度 (DOP)。Oracle 的并行执行框架可让您明确选择甚至强制实行特定 DOP,或者,您也可以依赖 Oracle 来控制 DOP。

DEFAULT 并行度
在前面的示例中,我们只指定以并行方式访问一个对象,而未指定 DOP。这类情况下,Oracle 使用所谓的 DEFAULT 并行度。DEFAULT 并行度使用公式根据系统配置来确定 DOP,通常为 2 * CPU_COUNT;在RAC中,为 2 * CPU_COUNT * ACTIVE_INSTANCE_COUNT。因此,在每个节点有 8 个 CPU 内核的四节点RAC上,默认 DOP 将为 2 * 8 * 4 = 64。
 

DEFAULT 算法旨在使用最多资源(假设使用的资源越多,操作就会越快完成)。DEFAULT 并行度针对的是单用户负载。在多用户环境下,DEFAULT 并行度将迅速用完系统资源,没有留下可用资源以便其他用户并行执行。
固定并行度 (DOP)
与 DEFAULT 并行度不同,可以从 Oracle 数据库请求特定 DOP。例如,您可以在表或索引级别设置固定 DOP:
Alter table customers parallel 8 ;

Alter table sales parallel 16 ;
在此例中,只访问 customers 表的查询使用所请求的值为 8 的 DOP,访问 sales 表的查询将请求值为 16 的 DOP。访问 sales 和 customers 两个表的查询将以值为 16 的 DOP 进行处理,并且可能分配 32 个并行服务器(生成者/使用者)

当指定不同的 DOP 时,Oracle 使用更高的 DOP。


自动并行度
当自动并行度 (Auto DOP) 处于活动状态时,数据库将自动确定是否应并行执行语句以及应使用的 DOP。系统根据语句的资源需求来确定是否使用并行执行并选择 DOP。
如果语句的预计所用时间小于 PARALLEL_MIN_TIME_THRESHOLD(默认为 AUTO, 10 秒),则语句将串行运行。如果预计所用时间大于 PARALLEL_MIN_TIME_THRESHOLD,则优化器根据执行计划中所有扫描操作(全表扫描、索引快速全扫描等)的成本来以确定语句的理想 DOP。实际扫描成本直接取决于被访问对象的大小,从而确保确定的 DOP(只要被访问对象的大小不会显著更改)。
但是,优化器将对使用的实际 DOP 设置上限,以确保并行服务器进程不会导致系统过载。通过参数 PARALLEL_DEGREE_LIMIT (参见后面对该参数的说明)设置此上限。此参数的默认值是 CPU,这意味着 DOP 受系统上 CPU 数量的限制。
备注可以将 PARALLEL_DEGREE_LIMIT 设置为特定数值,这样您能够控制可在系统上使用的最大 DOP。

 

注意: 新创建表,如果不指定parallel参数,那么默认的degree是1

如果指定parallel,但不指定parallelism,那么degree就是DEFAULT,否则degree就是你指定的值.

 

说明: The degree of parallelism used for a SQL statement can be specified at three different levels:

■Statement level - Using hints such as PARALLEL or the PARALLEL clause 
■Object level - Found in the definition of the table, index, or other object. See: PARALLEL clause 
■Instance level - Using default values for the instance. See: parallel_threads_per_cpu x cpu_count 

The Cost-Based Optimizer determines whether to parallelize a statement and the degree of paralleism applied for a SQL statement by checking each item in this list in the order shown. Oracle first checks for a degree of parallelism specification at the statement level. If none is found, the table or index definitions are checked. If the table or index definition does not explicitly specify values for 
DEGREE and INSTANCES, then the default values established for the instance are used.

查询表和索引上的并行度设置

select table_name, degree, instances from dba_tables where trim(degree) != '1'or ( trim(instances) != '1' and trim(instances) != '0' );

select index_name, degree, instances from dba_indexes where trim(degree) != '1' or ( trim(instances) != '1' and trim(instances) != '0' );


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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值