Configuration parameter

join_collapse_limit — PostgreSQL Configuration Parameter

Category Query Planner Default 8 Unit boolean / enum / numeric Change scope Per-session (SET)

Max FROM items before the planner stops reordering joins.

At a glance

Property Value
Parameter join_collapse_limit
Category Query Planner
Default 8
Value type boolean / enum / numeric
Change scope Per-session (SET)

What it does

Above this many tables in a join, the planner stops exhaustively reordering and follows the written join order, trading plan quality for planning time.

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 join_collapse_limit; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'join_collapse_limit';.

Tuning guidance

Raise (e.g. 12-16) for big star/snowflake joins where a better plan justifies longer planning. Keep from_collapse_limit in step.

Reference

PostgreSQL documentation — Query Planner configuration.

Was this helpful?

← All configuration parameters