Repository navigation
constraint_exclusion = on excludes base relations - #1622
Merged
Merged
Conversation
# Conflicts: # CHANGELOG.md
This was referenced Nov 18, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
More of
relation_excluded_by_constraints(rupg-execmembers()), after #1613, which covered tree members atpartition.constraint_exclusion = on: the relation itself is a base relation that can be excluded. This covers a plain table, a table underONLY, the parent of anINHERITStree and a partitioned table.include_noinheritis!inh, andinclude_notnullis!inh || partitioned, as inplancat.c.Result,Replaces: Scan on …,One-Time Filter: false). A join of it is dummy as well, and so is the inner side of a left join whoseONexcludes it.a > 5 AND a < 3,a = 1 AND a = 2).onthey exclude the relation.partitionthey exclude every member of a tree (not a table alone).partitiondoes not pay for it.eval_const_expressionsreduces withvar_is_nonnullable,col IS NULL/IS NOT NULLof a validly not-null, non-row column of the table becomes a constant.AND/OR/NOTfolding that follows folds onlytrueandfalse.canonicalizetreats a null arm as false, which is wrong for CHECK semantics.CHECK (a IS NULL OR b > 2)witha NOT NULLisb > 2.Limit: a partition named directly at
ondoes not yet add its partition constraint (include_partition).Fixture
connection/exclusion_on.test, the output of PostgreSQL 19 for the same script. It includes the two dummy-plan cases ofpredicate.sql, a plain table atpartitionand aton(refuted, kept,OR, contradictory, volatile, left join inWHEREand inON, aggregate,UPDATE,DELETE), and anINHERITStree with aNO INHERITconstraint, with and withoutONLY, at both settings.Regression (changed lines of the diff, against the run after #1620):
partition_prune2393 → 2332,join2027 → 2003,predicate146 → 122. No other test of the targeted set changed.Part of the M7 regression work.