GitHub user yjhjstz added a comment to the discussion: [Ideas] Add ORCA 
intra-segment parallel scan support for partitioned AO tables

Thanks for the very thorough report, @Alena0704. Your code reading matches what 
is on main today, and the conclusion is right: this is a missing capability in 
ORCA, not a cost-model decision.

Current state

- PR #1398 deliberately scoped intra-segment parallelism to plain CLogicalGet. 
CLogicalDynamicGet::PxfsCandidates() still only offers 
ExfDynamicGet2DynamicTableScan and ExfExpandDynamicGetWithForeignPartitions, so 
ORCA never generates a parallel alternative for a partitioned table. 
ExtractParallelWorkersFromDXL() returning 1 for EdxlopPhysicalDynamicTableScan 
is consistent with that, not a separate bug.
- The fallback you observed with optimizer_enable_dynamictablescan=off is 
expected. With that xform disabled, CLogicalDynamicGet has no physical 
implementation, ORCA fails to find a plan, and we fall back to the PostgreSQL 
planner. It happens to produce Parallel Append here, but it is not a supported 
way to ask ORCA for a parallel plan.
- This gap is part of the roadmap in discussion #1316, and dynamic scans are 
the natural next milestone after #1398.


I already have a draft PR for this and will open it shortly. It follows the 
second direction you described: reuse the dynamic-scan-to-Append translation 
and the existing Parallel Append executor, instead of making DynamicSeqScan 
parallel-aware. The main reasons:

1. CTranslatorExprToDXL::PdxlnDynamicScanToAppend() already emits the Append 
with the partition selector ids of the scan, so join-driven dynamic partition 
pruning is preserved.
2. Parallel Append over Parallel Seq Scan children gives both whole-partition 
scheduling and intra-partition parallelism. The AO parallel scan already splits 
work by segment file, so a single surviving partition still parallelizes, which 
a shared partition counter inside DynamicSeqScan would not do.
3. No new DSM walker is needed in execParallel.c; Append and SeqScan are 
already handled.

GitHub link: 
https://github.com/apache/cloudberry/discussions/2128#discussioncomment-18925986

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to