Oracle:为什么并行删除不并行?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17695670/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 01:47:36  来源:igfitidea点击:

Oracle: why parallel delete doesn't go parallel?

sqloracleparallel-processingdml

提问by Revious

I've tried the following statement. But it doesn't proceed parallel. Why? How can I speed up the operation?

我已经尝试了以下语句。但它不会并行进行。为什么?如何加快操作速度?

ALTER SESSION ENABLE PARALLEL DML;

DELETE /*+ parallel(20) */
      FROM  table
      WHERE flag != 'N';

enter image description here

在此处输入图片说明

回答by wanana

try

尝试

ALTER SESSION ENABLE PARALLEL DML;
DELETE /*+ parallel(table, 20) */
  FROM  table
  WHERE flag!= 'N';

you can also try another option to delete data, using CTAS, reference from asktom Deleting many rows from a big table

您还可以尝试另一种删除数据的选项,使用 CTAS,参考来自 asktom Deleting many rows from a big table

create table new_table unrecoverable as select * from old_table where ....;

drop table old_table;

rename new_table to old_table;

create index old_table_idx1 on old_table(c1,c2) unrecoverable parallel 5;

create table new_table unrecoverable as select * from old_table where ....;

删除表 old_table;

将 new_table 重命名为 old_table;

在 old_table(c1,c2) 不可恢复的并行 5 上创建索引 old_table_idx1;