Re: Remove useless pointer advance in StatsShmemInit() - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Remove useless pointer advance in StatsShmemInit()
Date
Msg-id zmsdnmcpfa3ck3s343in7yz5hzyuz6jlpyfvs2vgwgbum6focf@kkow5hfcybz6
Whole thread Raw
In response to Re: Remove useless pointer advance in StatsShmemInit()  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
List pgsql-hackers
Hi,

On 2025-12-02 07:40:44 +0000, Bertrand Drouvot wrote:
> From 2fefb69f1462ce1057bb5c3d07ed70c769ec961a Mon Sep 17 00:00:00 2001
> From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
> Date: Sat, 22 Nov 2025 14:47:25 +0000
> Subject: [PATCH v1] Remove useless pointer updates
> 
> Same idea as in commit 9b7eb6f02e8. Those pointers are updated but are not used
> after the updates, so let's remove the useless updates or document why we want
> to keep them.

I think this is a bad idea. To the degree that I think 9b7eb6f02e8 ought to be
reverted.  All these changes do is to make future extensions of the relevant
code more failure prone. Omitting the pointer update means that the pointer
at the end points before the last "chunk", rather than at the end.

What's the point of this? Compilers are perfectly capable of removing a
trailing store if the updated value isn't ever used afterwards.

Greetings,

Andres



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: All-visible pages with valid prune xid are confusing
Next
From: Sami Imseih
Date:
Subject: Re: [Proposal] Adding callback support for custom statistics kinds