Support 'ALTER TABLE REBALANCE' MVP#1845
Merged
whitehawk merged 18 commits intofeature/ADBDEV-6608from Jul 15, 2025
Merged
Conversation
+ Support table expand from alter rebalance
red1452
reviewed
Jul 13, 2025
red1452
left a comment
There was a problem hiding this comment.
Should be command autocompleted?
postgres=# alter table test
ADD ATTACH PARTITION DETACH PARTITION DROP INHERIT OWNER TO REPLICA IDENTITY SET
ALTER CLUSTER ON DISABLE ENABLE NO INHERIT RENAME RESET VALIDATE CONSTRAINT
postgres=# alter table test re
rename replica identity reset
Author
Added autocomplete for this command. It is a psql feature. |
…l to total Problem: Before this change, if a table was created via CTAS with Orca planner, next insert into this table could be planned also via Orca, though Orca shouldn't plan such queries as it doesn't support partially distributed queries and should fallback to Postgres planner. It was so, because MD cache wasn't reloaded. Fix: Completely forbid CTAS via Orca if target number of segments is not equal to total number of segments (as partial distribution is not yet supported in Orca).
red1452
approved these changes
Jul 14, 2025
bimboterminator1
approved these changes
Jul 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.
Support 'ALTER TABLE REBALANCE' MVP
Problem description:
There were no means to provide segments shrink feature to the 'gprebalance'
tool.
Fix:
Add new command 'ALTER TABLE <table_name> REBALANCE' (MVP level). Details:
number of segments (ex. 'ALTER TABLE <table_name> REBALANCE 2;').
table's distribution policy, rebalance command will invoke the existing
functionality of 'ALTER TABLE <table_name> EXPAND TABLE' (meaning that expand
will always be done to the current number of segments in the cluster, even if
we specified less)
table's distribution policy, the table will be shrunk into the target number
of segments. For hashed or randomly distributed tables, data from the excessive
segments is inserted into the target segments, and then for all table types the
distribution policy is updated for the target number of segments. Data from the
excessive segments is not removed (we do not want to spend time on it, as most
likely they will be excluded from the cluster soon anyway).
not specified for the 'ALTER TABLE <table_name> REBALANCE' command, value of
'gp_target_numsegments' is used.
number of segments.