On Fri, Jul 8, 2022 at 9:40 AM Zhihong Yu <z...@yugabyte.com> wrote: > Hi, > Here is the query which involves aggregate on a single column: > > > https://dbfiddle.uk/?rdbms=postgres_13&fiddle=44bfd8f6b6b5aad34d00d449c04c5a96 > > As you can see from `Output:`, there are many columns added which are not > needed by the query executor. > > I wonder if someone has noticed this in the past. > If so, what was the discussion around this topic ? > > Thanks > Hi, With the patch, I was able to get the following output:
explain (analyze, verbose) /*+ IndexScan(t) */select count(fire_year) from fires t where objectid <= 2000000; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=119.00..119.01 rows=1 width=8) (actual time=9.453..9.453 rows=1 loops=1) Output: count(fire_year) -> Index Scan using fires_pkey on public.fires t (cost=0.00..116.50 rows=1000 width=4) (actual time=9.432..9.432 rows=0 loops=1) Output: fire_year Index Cond: (t.objectid <= 2000000) Planning Time: 52.598 ms Execution Time: 13.082 ms Please pay attention to the column list after `Output:` Tom: Can you take a look and let me know what I may have missed ? Thanks
index-scan-with-non-returnable.patch
Description: Binary data