Re: Infinite Interval
Dean Rasheed <dean.a.rasheed@gmail.com>
From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: jian he <jian.universality@gmail.com>
Cc: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>,
Joseph Koshakow <koshy44@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, "Gregory Stark (as CFM)" <stark.cfm@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-09-19T11:14:20Z
Lists: 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
Commits
-
Support +/- infinity in the interval data type.
- 519fc1bd9e9d 17.0 landed
-
Avoid integer overflow hazard in interval_time().
- 3850d4dec1d9 17.0 landed
-
Guard against overflow in make_interval().
- b2d55447a563 17.0 landed
-
Fix minmax-multi on infinite date/timestamp values
- 8da86d62a112 17.0 cited
-
Optimize various aggregate deserialization functions, take 2
- 0c882a298881 17.0 cited
-
Remove dead code in DecodeInterval()
- d6d1430f4043 17.0 cited
-
Accept "+infinity" in date and timestamp[tz] input.
- 2ceea5adb026 16.0 cited
-
Fix overflow hazards in interval input and output conversions.
- e39f99046710 15.0 cited