Re: Infinite Interval - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: Infinite Interval
Date
Msg-id CAEZATCUJ0xjyQUL7SHKxJ5a+Dm5pjoq-WO3NtkDLi6c76rh58w@mail.gmail.com
Whole thread Raw
In response to Re: Infinite Interval  (jian he <jian.universality@gmail.com>)
Responses Re: Infinite Interval
List pgsql-hackers
On Sat, 16 Sept 2023 at 01:00, jian he <jian.universality@gmail.com> wrote:
>
> I refactor the avg(interval), sum(interval), so moving aggregate,
> plain aggregate both work with +inf/-inf.
> no performance degradation, in fact, some performance gains.
>

I haven't reviewed this part in any detail yet, but I can confirm that
there are some impressive performance improvements for avg(). However,
for me, sum() seems to be consistently a few percent slower with this
patch.

The introduction of an internal transition state struct seems like a
promising approach, but I think there is more to be gained by
eliminating per-row pallocs, and IntervalAggState's MemoryContext
(interval addition, unlike numeric addition, doesn't require memory
allocation, right?).

Also, this needs to include serialization and deserialization
functions, otherwise these aggregates will no longer be able to use
parallel workers. That makes a big difference to queryE, if the size
of the test data is scaled up.

This comment:

+   int64       N;              /* count of processed numbers */

should be "count of processed intervals".

Regards,
Dean



pgsql-hackers by date:

Previous
From: Dean Rasheed
Date:
Subject: Re: CHECK Constraint Deferrable
Next
From: Ranier Vilela
Date:
Subject: Re: Standardize type of variable when extending Buffers