Re: GUC thread-safety approaches

From: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: GUC thread-safety approaches
Date: 2025-11-18 20:37:43
Message-ID: CAGECzQTuFaMcCPbQQQ9JDpkESkkHB==cvWVNzHR+vK6JLPwAFg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 18, 2025, 11:26 Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:

> The way I understand this, this would only work if
> DefineCustomXXXVariable could only be called from a global context
> (e.g., shared_preload_libraries). But AFAICT, you can define custom GUC
> parameters per session (e.g., LOAD 'auto_explain'), and so each session
> would have a different offset, and so the offset variable would itself
> have to be session-local.
>

I think that a session-local LOAD is something we're going to lose with
threading anyway. A shared library is only going to be loaded once for the
cluster, not once per backend. And to be clear: I think that's totally
fine. (i.e. the benefit of these session-local extensions seems to small
for us to find and maintain some workaround for this)

So having a DefineCustomXXXVariable only be callable from a global context
seems fine to me.

I quite like the idea of this global offset array btw.

>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message KAZAR Ayoub 2025-11-18 20:42:39 Re: Speed up COPY FROM text/CSV parsing using SIMD
Previous Message Masahiko Sawada 2025-11-18 20:22:02 Re: POC: enable logical decoding when wal_level = 'replica' without a server restart