columnar: serialize CREATE INDEX on columnar tables for PG19#8618
Open
ihalatci wants to merge 1 commit into
Open
columnar: serialize CREATE INDEX on columnar tables for PG19#8618ihalatci wants to merge 1 commit into
ihalatci wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## pg19-runtime-fixes #8618 +/- ##
======================================================
+ Coverage 88.94% 88.95% +0.01%
======================================================
Files 288 288
Lines 64368 64376 +8
Branches 8092 8093 +1
======================================================
+ Hits 57251 57267 +16
+ Misses 4780 4776 -4
+ Partials 2337 2333 -4 🚀 New features to boost your workflow:
|
a31f940 to
83042a9
Compare
89495aa to
9d9144a
Compare
PG19 enables parallel CREATE INDEX by default (max_parallel_maintenance_workers defaults to 2). Columnar's TableAM is always serial: rs_parallel is stored but never read, and the build path flushes pending writes, which is disallowed inside a parallel operation. Three changes: 1. Provide working parallelscan_estimate/initialize/reinitialize that delegate to the table_block_* helpers, so callers that unconditionally size and initialize a ParallelTableScanDesc (e.g. PG19's parallel btree build) do not abort. Columnar ignores the descriptor, so the state is simply unused. 2. In columnar_index_build_range_scan, accept a parallel scan descriptor by discarding it (scan = NULL) and running the serial path. 3. In ColumnarProcessUtility, when the statement is CREATE INDEX on a columnar AM relation, force max_parallel_maintenance_workers=0 via NewGUCNestLevel/AtEOXact_GUC around PrevProcessUtilityHook so the build runs serially without triggering "cannot update tuples during a parallel operation". DESCRIPTION: Serialize CREATE INDEX on columnar tables on PG19 Closes #8611 Part of #8597
9d9144a to
3a0a90e
Compare
83042a9 to
59c5dc3
Compare
This was referenced Jun 13, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses PostgreSQL 19’s default parallel CREATE INDEX behavior to ensure columnar TableAM index builds run safely in a serial mode and no longer fail due to missing/unsupported parallel-scan plumbing.
Changes:
- Implement parallel-scan callback support for columnar by delegating initialization/reinitialization to the block-table helper callbacks (to satisfy PG19 callers that size/init parallel scan state unconditionally).
- Ensure columnar index builds ignore any provided parallel scan descriptor and proceed via the serial scan path.
- Force
max_parallel_maintenance_workers=0forCREATE INDEXtargeting columnar relations by temporarily nesting/restoring the GUC aroundPrevProcessUtilityHook.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
424
to
428
| static Size | ||
| columnar_parallelscan_estimate(Relation rel) | ||
| { | ||
| elog(ERROR, "columnar_parallelscan_estimate not implemented"); | ||
| return sizeof(ParallelBlockTableScanDescData); | ||
| } |
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.
Stacked PR (PR3 of the PG19 stack). Base =
pg19-runtime-fixes(#8617) →pg19-ci-test-matrices(#8616) →pg19-ruleutils-port(#8602) →pg19-support. Review/merge in stack order.PG19 enables parallel
CREATE INDEXby default (max_parallel_maintenance_workersdefaults to 2). Columnar's TableAM is always serial —rs_parallelis stored but never read, and the build path flushes pending writes, which is disallowed inside a parallel operation. This causedCREATE INDEXon columnar tables to fail on PG19.Three changes (all in
columnar_tableam.c):parallelscan_estimate/initialize/reinitializenow delegate to thetable_block_*helpers, so callers that unconditionally size and initialize aParallelTableScanDesc(e.g. PG19's parallel btree build) no longer abort. Columnar ignores the descriptor, so the written state is simply unused.columnar_index_build_range_scanaccepts a parallel scan descriptor by discarding it (scan = NULL) and running the serial path.ColumnarProcessUtilityforcesmax_parallel_maintenance_workers=0(viaNewGUCNestLevel/AtEOXact_GUCaroundPrevProcessUtilityHook) forCREATE INDEXon a columnar AM relation, so the build runs serially.Closes #8611
Part of #8597