Re: Partial Mode in Aggregate Functions

From: Marcos Pegoraro <marcos(at)f10(dot)com(dot)br>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Partial Mode in Aggregate Functions
Date: 2026-03-01 14:54:27
Message-ID: CAB-JLwa3qwxPbQ4V8wnnd4OVz2nTL=mGfrsK9C4X0ZnnC_uqmg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em dom., 1 de mar. de 2026 às 11:29, David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> escreveu:

> I can’t come up with a better header than Partial Mode.
>

The problem is that if they conclude that there is no FILTER for that
aggregate,
they decide to run two queries, not the most readable or the most
performant one.
with Data as (select V from MyTable where F1 = 100)
select (select jsonb_agg(V) from Data) Total,
(select jsonb_agg(V) from MyTable where V>1) Filtered;

regards
Marcos

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marcos Pegoraro 2026-03-01 15:00:09 Re: Partial Mode in Aggregate Functions
Previous Message Daniil Davydov 2026-03-01 14:46:42 Re: POC: Parallel processing of indexes in autovacuum