-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ao set ao aoco-related cherry-picks #886
Merged
Merged
Conversation
This file contains 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
my-ship-it
approved these changes
Jan 22, 2025
12e5b7c
to
afab447
Compare
Currently adding support for the following cases: ``` CREATE TABLE foo (appendonly=true); ALTER TABLE foo SET ACCESS METHOD ao_column; -- Or: ALTER TABLE foo SET WITH (appendonly=true, orientation=column); ``` Similar to other variations of ATSETAM commands, user can also specify reloptions in a WITH clause, such as: ``` ALTER TABLE foo SET ACCESS METHOD ao_column WITH (blocksize=65536); ``` If no reloptions are given, the new AOCO table will use the existing table-level options for its column encoding options. If any reloption is given in the WITH clause, it will be recorded in the catalog and then used for the column encoding option too. Note that there was once a thought to support specifying column-level encoding in the ATSETAM command, but was abandoned because there exists better alternatives. Discussions see https://groups.google.com/a/greenplum.org/g/gpdb-dev/c/NaNH6TssgA8
Previously, we only remove the existing reloptions when the AM is changing between Heap and AO/AOCO, since the reloptions are mutually exclusive between them. Now we do the same when changing AM between AO and AOCO too, for the following reasons: 1. Keep behaviors consistent. 2. Even between AO and AOCO there's certain reloption that's not applicable to one of them: e.g. 'compresslevel=rle_type' only applies to AOCO but not AO. 3. If customer specifies reloptions themselves within the ATSETAM statement, we then need to pick and remove those conflicting with the new reloptions. Too much complicities will be introduced. With this change, we also refactored ATExecSetRelOptions a little bit since now we don't rely on it to remove reloptions. And it becomes more readable too.
As part of the ATSETAM support, this commit adds support for changing AM of a table from AOCO to AO. E.g.: ``` CREATE TABLE foo (appendonly=true, orientation=column); ALTER TABLE foo SET ACCESS METHOD ao_row; -- Or: ALTER TABLE foo SET WITH (appendoptimized=true); ``` Optionally, user can specify reloptions in a WITH clause too, e.g.: ``` ALTER TABLE foo SET ACCESS METHOD ao_row WITH (compresslevel=7); ``` Additionally for the regress test: 1. Add more cases for altering with the same existing AM; 2. Add more cases for the "Final scenario" in the test.
It is found that when changing from AO to AOCO we cannot specify `compresstype=rle_type` which would complain that it is not applicable to AO table, despite that it should be a valid usage. This is because during setting new reloptions, we miss the information about the new AM being AOCO, and the code behavior is to validate the reloptions as AO tables. Fixing it by passing the new AM into ATExecSetRelOptions() based on which we can validate the reloptions. If there is no AM change, an InvalidOid will be passed in and we will use the current table AM to validate the reloptions.
Currently adding support for the following cases: ``` CREATE TABLE foo; ALTER TABLE foo SET ACCESS METHOD ao_column; -- Or: ALTER TABLE foo SET WITH (appendonly=true, orientation=column); ``` Similar to other variations of ATSETAM commands, user can also specify reloptions in a WITH clause, such as: ``` ALTER TABLE foo SET ACCESS METHOD ao_column WITH (blocksize=65536); ``` If no reloptions are given, the new AOCO table will use the default reloptions for its column encoding options. If any reloption is given in the WITH clause, it will be recorded in the catalog and then used for the column encoding option too.
As part of the ATSETAM support, this commit adds support for changing AM of a table from AOCO to heap. E.g.: ``` CREATE TABLE foo (appendonly=true, orientation=column); ALTER TABLE foo SET ACCESS METHOD heap; -- Or: ALTER TABLE foo SET WITH (appendonly=false); ``` Optionally, user can specify reloptions in a WITH clause too, e.g.: ``` ALTER TABLE foo SET ACCESS METHOD heap WITH (fillfactor=70); ```
7f45a8d
to
a04125e
Compare
Denchick
approved these changes
Jan 25, 2025
a04125e
to
abddf09
Compare
x4m
approved these changes
Jan 25, 2025
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 #ISSUE_Number
What does this PR do?
needed for #859
Type of Change
Breaking Changes
Test Plan
make installcheck
make -C src/test installcheck-cbdb-parallel
Impact
Performance:
User-facing changes:
Dependencies:
Checklist
Additional Context
CI Skip Instructions