Re: Partial aggregates pushdown

From: Ilya Gladyshev <i(dot)gladyshev(at)postgrespro(dot)ru>
To: Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru>
Cc: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Subject: Re: Partial aggregates pushdown
Date: 2021-11-01 21:53:54
Message-ID: b54235b5-f0dd-33ba-5e8f-02f816e051bf@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 01.11.2021 13:30, Alexander Pyhalov wrote:
> Peter Eisentraut писал 2021-11-01 12:47:
>> On 21.10.21 12:55, Alexander Pyhalov wrote:
>>> Now aggregates with internal states can be pushed down, if they are
>>> marked as pushdown safe (this flag is set to true for min/max/sum),
>>> have internal states and associated converters. Converters are
>>> called locally, they transform aggregate result to serialized
>>> internal representation.
>>> As converters don't have access to internal aggregate state, partial
>>> aggregates like avg() are still not pushable.
>>
>> It seems to me that the system should be able to determine from the
>> existing aggregate catalog entry whether an aggregate can be pushed
>> down.  For example, it could check aggtranstype != internal and
>> similar.  A separate boolean flag should not be necessary.
>
> Hi.
> I think we can't infer this property from existing flags. For example,
> if I have avg() with bigint[] argtranstype, it doesn't mean we can
> push down it. We couldn't also decide if partial aggregete is safe to
> push down based on aggfinalfn presence (for example, it is defined for
> sum(numeric), but we can push it down.

I think one potential way to do it would be to allow pushing down
aggregates that EITHER have state of the same type as their return type,
OR have a conversion function that converts their return value to the
type of their state.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2021-11-01 21:57:48 Re: Partial aggregates pushdown
Previous Message Mark Dilger 2021-11-01 21:42:42 Re: Delegating superuser tasks to new security roles (Was: Granting control of SUSET gucs to non-superusers)