As clearly stated in the Licensing Information guide, all features related to parallel processing (parallel backup and recovery, parallel query/DML, parallel statistics gathering, parallel index build/scans, parallel Data Pump export/import, in-memory parallel execution, parallel statement queuing and parallel spatial index builds) are only available with the Enterprise Edition. However, as of Oracle Database 11g Release 2, there is a feature that provides parallel processing capabilities in the Standard Edition as well. This feature is available through the DBMS_PARALLEL_EXECUTE package.
For example, let’s say that you have to execute an UPDATE statement on all rows of a table containing a huge amount of data. If you can take the table “offline”, provided you have enough space doing a CTAS statement instead of an UPDATE statement is probably much faster. However, if you cannot put the table “offline”, doing it in parallel might be a sensible way to speed-up the execution. Hence, if you are using the Enterprise Edition you can take advantage of the parallel processing features integrated in the SQL engine. Thus, you can execute something like that:
ALTER SESSION ENABLE PARALLEL DML; UPDATE /*+ parallel(t,4) */ t SET col = expr;
Since such a possibility is not available with the Standard Edition, as of Oracle Database 11g Release 2 you might execute a PL/SQL block like the following one to perform the same operation in parallel:
SET SERVEROUTPUT ON DECLARE l_task_name user_parallel_execute_tasks.task_name%TYPE; l_sql_stmt user_parallel_execute_tasks.sql_stmt%TYPE; BEGIN l_task_name := 'px_update'; l_sql_stmt := 'UPDATE t SET col = expr WHERE rowid BETWEEN :start_id AND :end_id'; dbms_parallel_execute.create_task(task_name => l_task_name); dbms_parallel_execute.create_chunks_by_rowid( task_name => l_task_name, table_owner => user, table_name => 'T', by_row => FALSE, chunk_size => 128 ); dbms_parallel_execute.run_task( task_name => l_task_name, sql_stmt => l_sql_stmt, language_flag => dbms_sql.native, parallel_level => 4 ); WHILE (dbms_parallel_execute.task_status(task_name => l_task_name) NOT IN ( dbms_parallel_execute.chunking_failed, dbms_parallel_execute.finished, dbms_parallel_execute.finished_with_error, dbms_parallel_execute.crashed )) LOOP dbms_lock.sleep(1); END LOOP; CASE dbms_parallel_execute.task_status(task_name => l_task_name) WHEN dbms_parallel_execute.chunking_failed THEN dbms_output.put_line('chunking_failed'); WHEN dbms_parallel_execute.finished THEN dbms_output.put_line('finished'); WHEN dbms_parallel_execute.finished_with_error THEN dbms_output.put_line('finished_with_error'); WHEN dbms_parallel_execute.crashed THEN dbms_output.put_line('crashed'); END CASE; dbms_parallel_execute.drop_task(task_name => l_task_name); END; /
Note that using the DBMS_PARALLEL_EXECUTE package is not limited to the Standard Edition, though. I see at least two situations where it can be handy with the Enterprise Edition:
- You do not want to process the whole DML statement in a single transaction.
- You want to process in parallel a PL/SQL block, not a DML statement.
Both situations are relevant if, as of Oracle Database 11g Release 2, you plan to perform such an operation during an online application upgrade by taking advantage of edition-based redefinition. I guess that the package was implemented for that purpose…