ORCA: allow different strategy control the redistribute key below aggregate#1192
Merged
jiaqizho merged 1 commit intoapache:mainfrom Aug 15, 2025
Merged
Conversation
d5193a0 to
0e158c8
Compare
0e158c8 to
43c05cf
Compare
leborchuk
reviewed
Jul 14, 2025
43c05cf to
185149c
Compare
leborchuk
reviewed
Aug 7, 2025
leborchuk
approved these changes
Aug 15, 2025
185149c to
d1985bd
Compare
…regate In CBDB, if there is an AGG operator (one-step AGG or final AGG operator) that requires data redistribution, then the redistribution motion operator will used all `GROUP BY` keys as the redistribute keys. In fact, only a single key needs to be redistributed, and the results of AGG will be the same. Reducing the number of redistributed keys can effectively reduce the overhead of hash function calls in motion operator. However, this may lead to data skew. Therefore, the current commit provides several different strategies for deciding how redistribution keys should be selected during redistribution motion operator (which under the AGG operator). User can use the GUC `optimizer_agg_pds_strategy` to select the strategies. - OPTIMIZER_AGG_PDS_ALL_KEY(value: 0): default one, select all `GROUP BY` key as the redistributed keys. - OPTIMIZER_AGG_PDS_FIRST_KEY(value: 1): select the first `GROUP BY` key as the redistributed keys. - OPTIMIZER_AGG_PDS_MINIMAL_LEN_KEY(value: 2): select a `GROUP BY` key which has the minimal and positive typlen as the redistributed keys. If only non-fixed type (such as text and varchar) exist, select the first `GROUP BY` key. - OPTIMIZER_AGG_PDS_EXCLUDE_NON_FIXED(value: 3): select the `GROUP BY` key which is fixed typlen the redistributed keys. If only non-fixed type (such as text and varchar) exist, select the first `GROUP BY` key.
d1985bd to
44c35bf
Compare
gongxun0928
approved these changes
Aug 15, 2025
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.
…regate
Fixes #ISSUE_Number
What does this PR do?
Type of Change
Breaking Changes
Test Plan
make installcheckmake -C src/test installcheck-cbdb-parallelImpact
Performance:
User-facing changes:
Dependencies:
Checklist
Additional Context
CI Skip Instructions