On Mon, Aug 03, 2026 at 05:46:37PM -0500, Sami Imseih wrote:
> /* Bump reference count for this segment in shared memory. */
> LWLockAcquire(DynamicSharedMemoryControlLock, LW_EXCLUSIVE);
> nitems = dsm_control->nitems;
> for (i = 0; i < nitems; ++i)
> {
> /*
> * If the reference count is 0, the slot is actually unused. If the
> * reference count is 1, the slot is still in use, but the segment is
> * in the process of going away; even if the handle matches, another
> * slot may already have started using the same handle value by
> * coincidence so we have to keep searching.
> */
> if (dsm_control->item[i].refcnt <= 1)
> continue;
> ```

Oh, that could be nice as a change on its own.

> I will need to do some benchmarking to see if there are improvement, but
> these will be optimizations for for high churn cases.

I could buy plugging in pgstats into the registry if it proves that
the degraded numbers you have seen are gone in the extreme high-churn
case, FWIW.
--
Michael

Attachment: signature.asc
Description: PGP signature

Reply via email to