GitHub user my-ship-it edited a comment on the discussion: [Proposal] Enhanced 
ORCA Parallel Planning to Align with PostgreSQL Planner

> ```c++
> class CDistributionSpecRandom : public CDistributionSpec
> {
> public:
>     enum EDistributionLevel
>     {
>         EdlSegment,     // Cross-segment distribution
>         EdlWorker       // Intra-segment distribution to worker threads
>     };
>     // New members
>     EDistributionLevel m_edl;                 // Distribution level
>     ULONG m_ulWorkers;                        // Number of workers
>     CDistributionSpec *m_pdsSegmentBase;      // Base segment distribution
> };
> ```
> 
> expand CDistributionSpecRandom.

After going through following inherited classes from CDistributionSpec:
Inherited directly:
* CDistributionSpecAny
* CDistributionSpecRandom
* CDistributionSpecUniversal
* CDistributionSpecNonSingleton
* CDistributionSpecRouted
* CDistributionSpecReplicated
* CDistributionSpecSingleton

And inherited indirectly:
* CDistributionSpecHashed(from CDistributionSpecRandom)
* CDistributionSpecStrictRandom(from CDistributionSpecRandom)
* CDistributionSpecStrictHashed(from CDistributionSpecHashed)
* CDistributionSpecHashedNoOp(from CDistributionSpecHashed)
* CDistributionSpecStrictSingleton(from CDistributionSpecSingleton)
* CDistributionSpecNonReplicated(from CDistributionSpecSingleton)

We also need to consider CDistributionSpecReplicated for replicated table at 
least.
For example, 
```
create table rt1(a int, b int) with(parallel_workers=2) distributed replicated;
create table rt2(a int, b int) distributed replicated;

explain(locus, costs off) select * from rt1 join rt2 on rt2.b = rt1.a;
                    QUERY PLAN
--------------------------------------------------
 Gather Motion 2:1  (slice1; segments: 2)
   Locus: Entry
   ->  Parallel Hash Join
         Locus: SegmentGeneralWorkers
         Parallel Workers: 2
         Hash Cond: (rt2.b = rt1.a)
         ->  Parallel Seq Scan on rt2
               Locus: SegmentGeneralWorkers
               Parallel Workers: 2
         ->  Parallel Hash
               Locus: SegmentGeneral
               ->  Parallel Seq Scan on rt1
                     Locus: SegmentGeneralWorkers
                     Parallel Workers: 2
```

GitHub link: 
https://github.com/apache/cloudberry/discussions/1316#discussioncomment-14427044

----
This is an automatically sent email for dev@cloudberry.apache.org.
To unsubscribe, please send an email to: dev-unsubscr...@cloudberry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@cloudberry.apache.org
For additional commands, e-mail: dev-h...@cloudberry.apache.org

Reply via email to