| From: | Andrei Lepikhov <lepihov(at)gmail(dot)com> |
|---|---|
| To: | David Rowley <dgrowleyml(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz> |
| Cc: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Nathan Bossart <nathandbossart(at)gmail(dot)com> |
| Subject: | Re: SUM(int2)/SUM(int4) do not detect overflow of the int8 accumulator |
| Date: | 2026-09-04 11:54:04 |
| Message-ID: | d0fa5c4b-c801-4c6c-ad83-940c8fa93bb6@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 04/09/2026 10:55, David Rowley wrote:
> On Fri, 4 Sept 2026 at 16:59, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>> Any thoughts or comments from others?
> The patch adds PG_RETURN_INPUT(n) to avoid some of the branching in
> int4_sum() so that it immediately returns the aggstate when the value
> being aggregated is null. With my compiler, it cut int4_sum from 18
> down to 16 instructions.
Thanks for your attention.
I adopted your changes. Although I don't see any overhead beyond noise, it seems
better to optimise than to keep it as is.
Also, tests were rewritten - instead of a direct call, I have used the initcond
trick.
--
regards, Andrei Lepikhov,
pgEdge
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Detect-overflow-of-the-int8-accumulator-in-sum-an.patch | text/plain | 11.1 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shveta malik | 2026-09-04 12:03:14 | Re: Follow-up review items for update_deleted |
| Previous Message | Daniel Gustafsson | 2026-09-04 11:47:59 | Re: pgsql: Fix compilation with OpenSSL 4 |