[Oracle Notes]About Oracle parallel insert performance-有关oracle并行插入性能

Question:

I have an sql like this:

Insert into A
Select * from B;

Now I want it to run in parallel. My question is to parallelize the insert or select or both? See the following sqls, can you tell me which one is correct or which one has best performance. I don't have dba permission, so I cann't check its execute plan.

1) Insert /*+ parallel(A 6) */ into A select * from B;

2) Insert into A select/*+ parallel(B 6) */ * from B;

3) Insert /*+ parallel(A 6) */ into A select /*+ parallel(B 6) */ * from B;

Thank you!


Answer:

Parallelizing both the INSERT and the SELECT is the fastest.

(If you have a large enough amount of data, you have a decent server, everything is configured sanely, etc.)

You'll definitely want to test it yourself, especially to find the optimal degree of parallelism. There are a lot of myths surrounding Oracle parallel execution, and even the manual is sometimes horribly wrong.

On 11gR2, I would recommend you run your statement like this:

   SQL> set timing on

   SQL> alter session enable parallel dml;

   SQL> insert/*+ append parallel(6) */into A select * from B;

  1. You always want to enable parallel dml first.
  2. parallel(6) uses statement-level parallelism, instead of object-level parallelism. This is an 11gR2 feature that allows you to easily run everything in parallel witout having to worry about object aliases or access methods. For 10G you'll have to use multiple hints.
  3. Normally the append hint isn't necessary. If your DML runs in parallel, it will automatically use direct-path inserts. However, if your statement gets downgraded to serial, for example if there are no parallel servers available, then the append hint can make a big difference.

转载于:https://www.cnblogs.com/jefflu2012/archive/2012/08/20/2647100.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值