Re: Partial aggregates pushdown
От | Ilya Gladyshev |
---|---|
Тема | Re: Partial aggregates pushdown |
Дата | |
Msg-id | b54235b5-f0dd-33ba-5e8f-02f816e051bf@postgrespro.ru обсуждение исходный текст |
Ответ на | Re: Partial aggregates pushdown (Alexander Pyhalov <a.pyhalov@postgrespro.ru>) |
Ответы |
Re: Partial aggregates pushdown
|
Список | 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.
В списке pgsql-hackers по дате отправления: