orca: keep parallel semi joins from rewriting to dedup#1764
Open
aviralgarg05 wants to merge 1 commit into
Open
orca: keep parallel semi joins from rewriting to dedup#1764aviralgarg05 wants to merge 1 commit into
aviralgarg05 wants to merge 1 commit into
Conversation
yjhjstz
reviewed
May 25, 2026
| */ | ||
| if (gpdb::IsParallelModeOK()) | ||
| { | ||
| return ExfpNone; |
Member
There was a problem hiding this comment.
Disabling them removes a plan candidate that may have been the cost-optimal choice even for some serial queries in a parallel-enabled session, we need to find root cause .
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.
Fixes #1593
What does this PR do?
This change keeps ORCA from rewriting semi-joins into inner-join-plus-deduplicate plans when parallel planning is enabled.
The issue behind
orca_parallelwas plan instability: in parallel mode, ORCA could choose rewrite paths that produced a dedup-based fallback shape instead of a direct semi-join. That made the expected plan unstable and, more importantly, pushed ORCA toward a plan form that is not desirable for parallel semi-join execution.The fix is intentionally small and focused:
CXformLeftSemiJoin2InnerJoinCXformLeftSemiJoin2InnerJoinUnderGbboth rewrites now decline to fire when
gpdb::IsParallelModeOK()is true.That preserves the existing rewrite behavior for non-parallel planning, while keeping parallel semi-joins on the direct semi-join path.
Type of Change
Breaking Changes
None.
Test Plan
What I verified:
make installcheckmake -C src/test installcheck-cbdb-parallelManual verification performed:
Notes:
Impact
Performance:
No broad performance change is intended.
This only affects ORCA’s choice space in parallel semi-join planning by preventing two rewrite paths that can lead to unstable dedup-based plans. In practice, this should make plan selection more predictable for the affected parallel queries.
User-facing changes:
Users should see more stable ORCA plans for affected parallel semi-join queries.
There is no SQL behavior change and no syntax change.
Dependencies:
None.
Checklist
Additional Context
This patch is intentionally narrow.
I avoided broader planner changes and did not touch regression files without a verified regenerated answer file from a clean local run. The code change is limited to the two ORCA xforms responsible for the semi-join-to-dedup rewrite path.
CI Skip Instructions
No CI skip requested.