PL/SQL 中的并行性

发布于 2024-09-09 03:27:59 字数 50 浏览 0 评论 0原文

我如何在 pl-sql- 中并行运行一个查询?

我需要所有的流量...

how can i run one query in pl-sql- in parallel?

i need all the flow...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

身边 2024-09-16 03:27:59

您可以创建作业以便并行运行相同的查询。

示例

CREATE OR REPLACE PROCEDURE target_deletion
IS
   number_of_the_job   NUMBER;
BEGIN
   DBMS_JOB.submit (number_of_the_job, 'begin stored_procedure_for_deletion; end;', SYSDATE);
END;
/

说明

请假设您的 Oracle 数据库中有一个存储过程,其名称如下:

stored_procedure_for_deletion

如果您希望使用 PARALLELISM 多次执行该存储过程,则必须创建一个名为“TARGET_DELETION”的存储过程(如上所示) ),这会创建一个新作业,该作业使用 PL/SQL 块调用:

beginstored_procedure_for_deletion;结尾;

...执行名为“stored_procedure_for_deletion”的过程。

该作业会立即启动,因此您可以连续多次运行存储过程 target_deletion,以便以并行方式运行相同的过程。

You can create JOBs in order to run the same query with parallelism.

EXAMPLE

CREATE OR REPLACE PROCEDURE target_deletion
IS
   number_of_the_job   NUMBER;
BEGIN
   DBMS_JOB.submit (number_of_the_job, 'begin stored_procedure_for_deletion; end;', SYSDATE);
END;
/

EXPLAINATION

Please suppose you have, in your Oracle DataBase, a stored procedure called exactly as follows:

stored_procedure_for_deletion

If you wish to execute that stored procedure many times with PARALLELISM, you have to create a stored procedure called for example "TARGET_DELETION" (written above), which creates a new job that invokes, with the PL/SQL block:

begin stored_procedure_for_deletion; end;

... the execution of your procedure called "stored_procedure_for_deletion".

The job starts immediately, so you can run the stored procedure target_deletion many consecutive times, in order to run the same procedure with parallelism.

只想待在家 2024-09-16 03:27:59

如果在实例级别启用,Oracle 本身具有并行查询功能:

http://www.orafaq.com/wiki /Parallel_Query_FAQ

编辑:不清楚您要做什么。也许您想要异步查询执行,因此Oracle作业建议是正确的(请参阅其他答案)。

Oracle并行特性不是异步的,它只是说优化器在查询执行时使用一定数量的CPU,以加速结果。例如:

select /*+ PARALLEL(DOGS,4) */ * from DOGS where A>20

以 4 级并行度执行查询。

If enabled at instance level, Oracle itself has parallel query features:

http://www.orafaq.com/wiki/Parallel_Query_FAQ

edit: it's not clear what you are trying to do. Maybe you want asynchronous query execution, so the Oracle job suggestion is correct (see the other answer).

Oracle parallel feature is not asynchronous, it just says the optimizer to use a certain number of CPUs in query execution, to speed up the result. For example:

select /*+ PARALLEL(DOGS,4) */ * from DOGS where A>20

executes your query with parallelism at degree 4.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文