gfphoenix78 opened a new issue, #1638:
URL: https://github.com/apache/cloudberry/issues/1638

   ```
   gpadmin=# CREATE TABLE mv_large (a int, b int, c text) USING PAX DISTRIBUTED 
BY (a);
   INSERT INTO mv_large SELECT i, i % 1000, 'large_' || (i % 10000) FROM 
generate_series(1, 1000000) i;
   CREATE TABLE
   INSERT 0 1000000
   
   gpadmin=# explain SELECT count(*) FROM (SELECT * FROM mv_large ORDER BY a 
LIMIT 100000) sub;
                                           QUERY PLAN
   
------------------------------------------------------------------------------------------
    Aggregate  (cost=0.00..431.00 rows=1 width=8)
      ->  Limit  (cost=0.00..431.00 rows=1 width=1)
            ->  Gather Motion 3:1  (slice1; segments: 3)  (cost=0.00..431.00 
rows=1 width=4)
                  Merge Key: a
                  ->  Sort  (cost=0.00..431.00 rows=1 width=4)
                        Sort Key: a
                        ->  Seq Scan on mv_large  (cost=0.00..431.00 rows=1 
width=4)
    Optimizer: GPORCA
   (8 rows)
   
   gpadmin=# set optimizer=off;
   SET
   gpadmin=# explain SELECT count(*) FROM (SELECT * FROM mv_large ORDER BY a 
LIMIT 100000) sub;
                                               QUERY PLAN
   
---------------------------------------------------------------------------------------------------
    Aggregate  (cost=2518.92..2518.93 rows=1 width=8)
      ->  Limit  (cost=1273.59..1935.17 rows=46700 width=40)
            ->  Gather Motion 3:1  (slice1; segments: 3)  
(cost=1273.59..1935.17 rows=46700 width=40)
                  Merge Key: mv_large.a
                  ->  Limit  (cost=1273.59..1312.50 rows=15567 width=40)
                        ->  Sort  (cost=1273.59..1312.50 rows=15567 width=40)
                              Sort Key: mv_large.a
                              ->  Seq Scan on mv_large  (cost=0.00..189.67 
rows=15567 width=40)
    Optimizer: Postgres query optimizer
   (9 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to