You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Postgres: unconditional nested join parentheses in 1.1.0 constrain the planner and regress query plans #12792
1.1.0 wraps a join and its children in parentheses whenever the join has children. For LEFT nested under LEFT this is semantically a no-op, but it constrains the PostgreSQL planner's join-order search and can cause large plan regressions.
Same underlying change as #12764, different symptom.
Expected Behavior
Nest only where flat emission would change results — an INNER child under an OUTER parent. Where parent and child are both LEFT, 1.0.0's flat form is equivalent and leaves the planner free.
Actual Behavior
Nesting is unconditional whenever childJoins is non-empty — query-builder/SelectQueryBuilder.js:
PostgreSQL 18.1, a query joining 7 tables off a ~570k-row root with one LEFT nested under another, ordered by a left-joined column with LIMIT/OFFSET. On upgrading 1.0.0 → 1.1.0 every pre-upgrade queryid in pg_stat_statements stopped accumulating at deploy time and traffic moved to new queryids containing JOIN (, averaging ~19s.
Suggested fix
Gate the parentheses on semantic necessity rather than the presence of children: nest when a child would otherwise alter outer-join semantics, emit flat otherwise.
Activity