avamingli commented on PR #1261:
URL: https://github.com/apache/cloudberry/pull/1261#issuecomment-3135176616

   Fix cases where window function operations that couldn't be parallel before 
can now be parallel in CBDB, such as window functions within subqueries.
    
   In UPSTREAM select_parallel.sql 
   
   > -- Window function calculation can't be pushed to workers.
    
    
   ```sql
   explain (costs off, verbose)
     select count(*) from tenk1 a where (unique1, two) in
       (select unique1, row_number() over() from tenk1 b);
                                                                                
                  QUERY PLAN                                                    
                                            
   
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Finalize Aggregate
      Output: count(*)
      ->  Gather Motion 6:1  (slice1; segments: 6)
            Output: (PARTIAL count(*))
            ->  Partial Aggregate
                  Output: PARTIAL count(*)
                  ->  Parallel Hash Semi Join
                        Hash Cond: ((a.unique1 = b.unique1) AND (a.two = 
(row_number() OVER (?))))
                        ->  Parallel Seq Scan on public.tenk1 a
                              Output: a.unique1, a.unique2, a.two, a.four, 
a.ten, a.twenty, a.hundred, a.thousand, a.twothousand, a.fivethous, a.tenthous, 
a.odd, a.even, a.stringu1, a.stringu2, a.string4
                        ->  Parallel Hash
                              Output: b.unique1, (row_number() OVER (?))
                              ->  Redistribute Motion 1:6  (slice2; segments: 1)
                                    Output: b.unique1, (row_number() OVER (?))
                                    Hash Key: b.unique1
                                    Hash Module: 3
                                    ->  WindowAgg
                                          Output: b.unique1, row_number() OVER 
(?)
                                          ->  Gather Motion 6:1  (slice3; 
segments: 6)
                                                Output: b.unique1
                                                ->  Parallel Seq Scan on 
public.tenk1 b
                                                      Output: b.unique1
    Settings: enable_parallel = 'on', min_parallel_table_scan_size = '0', 
optimizer = 'off', parallel_setup_cost = '0', parallel_tuple_cost = '0'
    Optimizer: Postgres query optimizer
   (24 rows)
   ``` 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to