Databases 8 min read

Boost Oracle Query Speed with Parallel Processing: A Practical Guide

This article explains how Oracle's parallel processing feature can accelerate data‑intensive queries by configuring session, table, or hint‑based parallelism, shows the degree‑of‑parallelism formula, and presents experimental results that compare execution times under different settings.

ITPUB
ITPUB
ITPUB
Boost Oracle Query Speed with Parallel Processing: A Practical Guide

Background

Modern CPUs have many cores, but Oracle Database processes SQL statements single‑threaded by default. Enabling Oracle Parallel Processing allows SQL operations to use multiple cores, improving performance for large‑scale data workloads, especially OLAP queries.

Parallel Features

Parallel Query

Parallel DDL

Parallel DML

Typical Use Cases

Range scans on tables or indexes

Bulk INSERT, UPDATE, DELETE

Creation of tables or indexes

Collecting statistics with DBMS_STATS

RMAN backup/restore

Setting Parallelism

Parallelism can be defined at three levels; precedence is hint > session > object.

ALTER SESSION FORCE PARALLEL QUERY PARALLEL n;   -- session level
ALTER TABLE tab_name PARALLEL n;                -- object level
SELECT /*+ PARALLEL(tab n) */ * FROM tab;      -- hint level

The degree of parallelism (DOP) should not exceed the number of logical CPUs. Oracle computes a default DOP as:

-- Single‑instance
DOP = PARALLEL_THREADS_PER_CPU * CPU_COUNT

-- RAC instance
DOP = PARALLEL_THREADS_PER_CPU * CPU_COUNT * INSTANCE_COUNT

Experiment Environment

Database: Oracle 11gR2 64‑bit

CPU_COUNT = 8

PARALLEL_THREADS_PER_CPU = 1

Test Procedure and Results

Step 1 – Baseline (no parallelism)

ALTER SESSION SET STATISTICS_LEVEL=ALL;
SELECT COUNT(1) FROM edidc;

Result: 47 262 191 rows. Execution plan shows a single‑threaded INDEX FAST FULL SCAN with elapsed time ~00:00:15.52 and 351 K buffers.

Step 2 – Force parallel query at session level

ALTER SESSION FORCE PARALLEL QUERY;
SELECT COUNT(1) FROM edidc;

Result: same row count. Execution plan now contains PX COORDINATOR, PX SEND QC, PX BLOCK ITERATOR and shows DOP equal to the default (8). Elapsed time reduced to ~00:00:13.86 and buffers dropped to 25.

Step 3 – Use explicit hint

SELECT /*+ PARALLEL(4) */ COUNT(1) FROM edidc;

Result: same row count. Plan shows DOP = 4 with similar timing (~00:00:13.86).

Step 4 – Set object parallelism

ALTER TABLE edidc PARALLEL 2;
-- gather statistics if needed
SELECT COUNT(1) FROM edidc;

Result: same row count. Plan shows DOP = 2 and elapsed time ~00:00:12.93.

Observations

Parallel execution reduces elapsed time for aggregation‑heavy queries; the gain depends on the chosen DOP.

DOP should be aligned with the number of logical CPUs; exceeding it yields diminishing returns.

In OLTP environments parallelism can increase contention and resource usage, so it must be applied judiciously.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

SQLdatabaseperformance tuningOracleparallel processing
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.