This page shows how parallel queries perform across 11 SQL constructs, measured on TPC Benchmark™H (TPC-H) workloads. For each construct, you can compare execution times before and after enabling parallel query on the same cluster.
This test is based on the TPC-H benchmark but does not meet all TPC-H requirements. Results may differ from published TPC-H benchmark figures.
Test environment
| Parameter | Value |
|---|---|
| Data volume | 100 GB (scale factor 100) |
| Cluster | PolarDB for MySQL 8.0 |
| Node specification | 88 CPU cores, 710 GB memory |
| Test target | Primary node |
Performance summary
The table below summarizes execution time before and after enabling parallel query across all tested SQL constructs.
| SQL construct | Parallel query off | Parallel query on | Time reduction |
|---|---|---|---|
| GROUP BY and ORDER BY | 1,563.32s | 49.65s | 96.82% |
| Aggregate functions (SUM, AVG, COUNT) | 1,563.32s | 49.65s | 96.82% |
| JOIN | 21.73s | 1.37s | 93.70% |
| BETWEEN and IN | 21.73s | 1.37s | 93.70% |
| LIMIT | 339.22s | 29.31s | 91.36% |
| INTERVAL | 220.87s | 7.75s | 96.49% |
| CASE WHEN | 220.87s | 7.75s | 96.49% |
| LIKE | 427.46s | 33.72s | 92.11% |
| Subqueries | 9.27s | 1.12s | 88.00% |
| GROUP BY WITH ROLLUP | 318.73s | 22.30s | 93.00% |
| INSERT ... SELECT and REPLACE ... SELECT | 182.82s | 23.25s | 87.28% |
GROUP BY and ORDER BY
SELECT l_returnflag,
l_linestatus,
Sum(l_quantity) AS sum_qty,
Sum(l_extendedprice) AS sum_base_price,
Sum(l_extendedprice * (1 - l_discount)) AS sum_disc_price,
Sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge,
Avg(l_quantity) AS avg_qty,
Avg(l_extendedprice) AS avg_price,
Avg(l_discount) AS avg_disc,
Count(*) AS count_order
FROM lineitem
WHERE l_shipdate <= date '1998-12-01' - INTERVAL '93' day
GROUP BY l_returnflag,
l_linestatus
ORDER BY l_returnflag,
l_linestatus;| Execution time | |
|---|---|
| Parallel query off | 1,563.32s |
| Parallel query on | 49.65s (3.18% of original) |
Parallel query off:

Parallel query on:

Aggregate functions (SUM, AVG, and COUNT)
SELECT l_returnflag,
l_linestatus,
Sum(l_quantity) AS sum_qty,
Sum(l_extendedprice) AS sum_base_price,
Sum(l_extendedprice * (1 - l_discount)) AS sum_disc_price,
Sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge,
Avg(l_quantity) AS avg_qty,
Avg(l_extendedprice) AS avg_price,
Avg(l_discount) AS avg_disc,
Count(*) AS count_order
FROM lineitem
WHERE l_shipdate <= date '1998-12-01' - INTERVAL '93' day
GROUP BY l_returnflag,
l_linestatus
ORDER BY l_returnflag,
l_linestatus;| Execution time | |
|---|---|
| Parallel query off | 1,563.32s |
| Parallel query on | 49.65s (3.18% of original) |
Parallel query off:

Parallel query on:

JOIN
select sum(l_extendedprice* (1 - l_discount)) as revenue
from lineitem, part
where ( p_partkey = l_partkey and p_brand = 'Brand#12'
and p_container in ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG')
and l_quantity >= 6 and l_quantity <= 6 + 10
and p_size between 1 and 5
and l_shipmode in ('AIR', 'AIR REG')
and l_shipinstruct = 'DELIVER IN PERSON' )
or ( p_partkey = l_partkey and p_brand = 'Brand#13'
and p_container in ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK')
and l_quantity >= 10 and l_quantity <= 10 + 10
and p_size between 1 and 10
and l_shipmode in ('AIR', 'AIR REG')
and l_shipinstruct = 'DELIVER IN PERSON' )
or ( p_partkey = l_partkey and p_brand = 'Brand#24'
and p_container in ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG')
and l_quantity >= 21 and l_quantity <= 21 + 10
and p_size between 1 and 15
and l_shipmode in ('AIR', 'AIR REG')
and l_shipinstruct = 'DELIVER IN PERSON' );| Execution time | |
|---|---|
| Parallel query off | 21.73s |
| Parallel query on | 1.37s (6.30% of original) |
Parallel query off:

Parallel query on:

BETWEEN and IN
select sum(l_extendedprice* (1 - l_discount)) as revenue
from lineitem, part
where ( p_partkey = l_partkey and p_brand = 'Brand#12'
and p_container in ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG')
and l_quantity >= 6 and l_quantity <= 6 + 10
and p_size between 1 and 5
and l_shipmode in ('AIR', 'AIR REG')
and l_shipinstruct = 'DELIVER IN PERSON' )
or ( p_partkey = l_partkey and p_brand = 'Brand#13'
and p_container in ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK')
and l_quantity >= 10 and l_quantity <= 10 + 10
and p_size between 1 and 10
and l_shipmode in ('AIR', 'AIR REG')
and l_shipinstruct = 'DELIVER IN PERSON' )
or ( p_partkey = l_partkey and p_brand = 'Brand#24'
and p_container in ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG')
and l_quantity >= 21 and l_quantity <= 21 + 10
and p_size between 1 and 15
and l_shipmode in ('AIR', 'AIR REG')
and l_shipinstruct = 'DELIVER IN PERSON' );| Execution time | |
|---|---|
| Parallel query off | 21.73s |
| Parallel query on | 1.37s (6.30% of original) |
Parallel query off:

Parallel query on:

LIMIT
select l_shipmode, sum(case when o_orderpriority = '1-URGENT' or o_orderpriority = '2-HIGH' then 1
else 0
end) as high_line_count, sum(case when o_orderpriority <> '1-URGENT' and o_orderpriority <> '2-HIGH' then 1
else 0
end) as low_line_count
from orders, lineitem
where o_orderkey = l_orderkey
and l_shipmode in ('MAIL', 'TRUCK')
and l_commitdate < l_receiptdate
and l_shipdate < l_commitdate
and l_receiptdate >= date '1996-01-01'
and l_receiptdate < date '1996-01-01' + interval '1' year
group by l_shipmode
order by l_shipmode limit 10;| Execution time | |
|---|---|
| Parallel query off | 339.22s |
| Parallel query on | 29.31s (8.64% of original) |
Parallel query off:

Parallel query on:

INTERVAL
select
100.00 * sum(case when p_type like 'PROMO%' then l_extendedprice * (1 - l_discount)
else 0
end) / sum(l_extendedprice * (1 - l_discount)) as promo_revenue
from lineitem, part
where l_partkey = p_partkey
and l_shipdate >= date '1996-01-01'
and l_shipdate < date '1996-01-01' + interval '1' month limit 10;| Execution time | |
|---|---|
| Parallel query off | 220.87s |
| Parallel query on | 7.75s (3.51% of original) |
Parallel query off:

Parallel query on:

CASE WHEN
select
100.00 * sum(case when p_type like 'PROMO%' then l_extendedprice * (1 - l_discount)
else 0
end) / sum(l_extendedprice * (1 - l_discount)) as promo_revenue
from lineitem, part
where l_partkey = p_partkey
and l_shipdate >= date '1996-01-01'
and l_shipdate < date '1996-01-01' + interval '1' month limit 10;| Execution time | |
|---|---|
| Parallel query off | 220.87s |
| Parallel query on | 7.75s (3.51% of original) |
Parallel query off:

Parallel query on:

LIKE
select s_name, s_address from
supplier, nation where
s_suppkey in
( select ps_suppkey from partsupp where
ps_partkey in ( select p_partkey from part where p_name like 'dark%')
and ps_availqty>(select 0.0005 * sum(l_quantity) as col1
from lineitem, partsupp
where l_partkey = ps_partkey and l_suppkey = ps_suppkey
and l_shipdate >= date '1993-01-01' and l_shipdate < date '1993-01-01' + interval '1' year)
)
and s_nationkey = n_nationkey and n_name = 'JORDAN'
order by s_name limit 10;| Execution time | |
|---|---|
| Parallel query off | 427.46s |
| Parallel query on | 33.72s (7.89% of original) |
Parallel query off:

Parallel query on:

Subqueries
select
s_acctbal,
s_name,
n_name,
p_partkey,
p_mfgr,
s_address,
s_phone,
s_comment
from
part,
supplier,
partsupp,
nation,
region
where
p_partkey = ps_partkey
and s_suppkey = ps_suppkey
and p_size = 35
and p_type like '%STEEL'
and s_nationkey = n_nationkey
and n_regionkey = r_regionkey
and r_name = 'AMERICA'
and ps_supplycost = (
select
min(ps_supplycost)
from
partsupp,
supplier,
nation,
region
where
p_partkey = ps_partkey
and s_suppkey = ps_suppkey
and s_nationkey = n_nationkey
and n_regionkey = r_regionkey
and r_name = 'AMERICA'
)
order by
s_acctbal desc,
n_name,
s_name,
p_partkey;
limit 1;| Execution time | |
|---|---|
| Parallel query off | 9.27s |
| Parallel query on | 1.12s (12% of original) |
Parallel query off:

Parallel query on:

GROUP BY WITH ROLLUP
For background on GROUP BY WITH ROLLUP, see MySQL ROLLUP.
select
l_returnflag,
l_linestatus,
sum(l_quantity) as sum_qty,
sum(l_extendedprice) as sum_base_price,
sum(l_extendedprice * (1 - l_discount)) as sum_disc_price,
sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge,
avg(l_quantity) as avg_qty,
avg(l_extendedprice) as avg_price,
avg(l_discount) as avg_disc,
count(*) as count_order
from
lineitem
where
l_shipdate <= date_sub('1998-12-01', interval ':1' day)
group by
l_returnflag,
l_linestatus
with rollup
order by
l_returnflag,
l_linestatus;| Execution time | |
|---|---|
| Parallel query off | 318.73s |
| Parallel query on | 22.30s (7.00% of original) |
Parallel query off:

Parallel query on:

INSERT ... SELECT and REPLACE ... SELECT
insert into line_item_ap
SELECT l_returnflag,
l_linestatus,
Sum(l_quantity) AS sum_qty,
Sum(l_extendedprice) AS sum_base_price,
Sum(l_extendedprice * (1 - l_discount)) AS sum_disc_price,
Sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge,
Avg(l_quantity) AS avg_qty,
Avg(l_extendedprice) AS avg_price,
Avg(l_discount) AS avg_disc,
Count(*) AS count_order
FROM lineitem
WHERE l_shipdate <= date '1998-12-01' - INTERVAL '93' day
GROUP BY l_returnflag,
l_linestatus
ORDER BY l_returnflag,
l_linestatus;| Execution time | |
|---|---|
| Parallel query off | 182.82s |
| Parallel query on | 23.25s (12.72% of original) |
Parallel query off:

Parallel query on:
