Skip to content

PG18 - window output in the explain #8156

@m3hm3t

Description

@m3hm3t
 -- Grouping can be pushed down with aggregates even when window function can't
 EXPLAIN (COSTS FALSE)
 SELECT user_id, count(value_1), stddev(value_1), count(user_id) OVER (PARTITION BY random())
 FROM users_table GROUP BY user_id HAVING avg(value_1) > 2 LIMIT 1;
                                    QUERY PLAN                                    
 ---------------------------------------------------------------------------------
  Limit
    ->  WindowAgg
+         Window: w1 AS (PARTITION BY remote_scan.worker_column_5)
          ->  Sort
                Sort Key: remote_scan.worker_column_5
                ->  Custom Scan (Citus Adaptive)
                      Task Count: 4
                      Tasks Shown: One of 4
                      ->  Task
                            Node: host=localhost port=57637 dbname=regression
                            ->  HashAggregate
                                  Group Key: user_id
                                  Filter: (avg(value_1) > '2'::numeric)
                                  ->  Seq Scan on users_table_1400256 users_table
-(13 rows)
+(14 rows)

postgres/postgres@8b1b342

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions