Configuration parameter

debug_parallel_query — PostgreSQL configuration parameter

Category Developer Options

Allows the use of parallel queries for testing purposes even in cases where no performance benefit is expected.

At a glance

Property Value
Parameter debug_parallel_query
Category Developer Options
Default (see documentation)
Value type enum
Change scope Per-session (SET)
Available in PostgreSQL 16, 17, 18, 19 (added in 16)

What it does

Allows the use of parallel queries for testing purposes even in cases where no performance benefit is expected. The allowed values of debug_parallel_query are off (use parallel mode only when it is expected to improve performance), on (force parallel query for all queries for which it is thought to be safe), and regress (like on, but with additional behavior changes as explained below).

More specifically, setting this value to on will add a Gather node to the top of any query plan for which this appears to be safe, so that the query runs inside of a parallel worker. Even when a parallel worker is not available or cannot be used, operations such as starting a subtransaction that would be prohibited in a parallel query context will be prohibited unless the planner believes that this will cause the query to fail. If failures or unexpected results occur when this option is set, some functions used by the query may need to be marked PARALLEL UNSAFE (or, possibly, PARALLEL RESTRICTED).

(Description quoted from the official PostgreSQL documentation.)

How to apply a change

Can be set per session with SET, per role/database with ALTER ROLE/DATABASE ... SET, or globally in postgresql.conf.

Inspect the current value and source with SHOW debug_parallel_query; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'debug_parallel_query';.

Tuning guidance

This is a developer and debugging aid, not a performance knob. Leave it at the default in production; enable it only temporarily, on a non-production or carefully controlled system, while diagnosing a specific problem. Several options in this group add overhead, generate large volumes of log output, or can damage data if misused — turn them off again as soon as the investigation is done.

Reference

PostgreSQL documentation — debug_parallel_query.

Keep going

Related & next steps

Concepts on this page

Was this helpful?

← All configuration parameters