-
Notifications
You must be signed in to change notification settings - Fork 132
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
Cherry-pick series of AO options/AO relations related commits. #871
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
reshke
changed the title
Support setting table-level reloptions for AO/AOCO tables
Cherry-pick series of AO options/AO relations related commits.
Jan 14, 2025
reshke
force-pushed
the
at_set_am2
branch
3 times, most recently
from
January 15, 2025 07:10
3e0d4db
to
1cbd57e
Compare
This allows a user to modify table-level AO reloptions such as compresslevel on an existing AO/AOCO table with: ALTER TABLE <> SET([reloptions]); Example: CREATE TABLE aorelopts USING ao_row AS SELECT * FROM generate_series(1, 1000); ALTER TABLE aorelopts SET (compresslevel=7, checksum=false); We rewrite the table as AO reloption changes imply on-disk changes. (We only rewrite the table if the options have really changed) Note: we got rid of the "fillfactor" reloption for AO tables as it was never really implemented. Also removed the "appendonly" reloption macro (SOPT_APPENDONLY) that's no longer used after we supported table AM for AO/AOCO tables. Co-authored-by: Huansong Fu <[email protected]>
Example workflow of changing access method from a Heap table (Oid:a) to an AO table: - Create transient AO table (Oid:b) and its AO aux tables in make_new_heap - Copy table data into the transient table - Swap Oids in the pg_appendonly entry so that newly generated aux tables are mapped to Oid a in ATAOEntries - Swap attributes in pg_class entry between the two tables (such as relfilenode, relam, ...) - Now dropping the transient table will use the heap AM and delete the original heap relation file.
This allow users to specify reloptions when they are switching the storage model of the table: ALTER TABLE <> SET ACCESS METHOD <> WITH ([reloptions]); We also support the legacy `appendonly`/`appendoptimized` options in the SET WITH clause: ALTER TABLE <> SET WITH (appendonly|appendoptimized=true|false, [reloptions]); Examples: CREATE TABLE tab (a int); ALTER TABLE tab SET ACCESS METHOD ao_row WITH (blocksize=65536); or: ALTER TABLE tab SET WITH (appendonly=true, blocksize=65536); Note that if a user specifies different access methods in a single statement, an error will be thrown. E.g.: ALTER TABLE ataoset SET ACCESS METHOD ao_row WITH(appendonly=true, orientation=column); ERROR: ACCESS METHOD is specified as "ao_row" but the WITH option indicates it to be "ao_column" LINE 1: ALTER TABLE ataoset SET ACCESS METHOD ao_row WITH(appendonly... ^ Also, normally access method change requires table rewrite. But if a user uses the above syntax but specify the same access method and/or reloptions, we will not do a table rewrite. Also adjusted the test output of alter_distribution_policy that the altered reloptions should be shown.
my-ship-it
previously approved these changes
Jan 16, 2025
Cherry-picked only 3 commit in this branch, as following commits tends to be really problematic, and i need these for #859 |
x4m
approved these changes
Jan 20, 2025
12 tasks
avamingli
approved these changes
Jan 21, 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?
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