From: dwsteele (@dwsteele) <noreply+dwsteele@github.com>
To: pgaudit/pgaudit <noreply+pgaudit-pgaudit@github.com>
Subject: Re: [pgaudit/pgaudit] issue #300: Severe performance degradation when enabling pgaudit (ddl,role only) under high insert load
Date: Thu, 13 Aug 2026 04:19:57 +0000
Message-ID: <gh-pgaudit-pgaudit-300-c5275912607@github.com> (raw)
In-Reply-To: <gh-pgaudit-pgaudit-300@github.com>
References: <gh-pgaudit-pgaudit-300@github.com>
> But what does this mean exactly? The errors in question happen when another extension calls ExecCheckPermission from its ProcessUtility hook, without calling the pgaudit ProcessUtility hook first.
What I mean is, that won't work when auditing is enabled. If pgAudit sees ExecutorCheckPerms without ExecutorStart or ProcessUtility then it has no context on what command is being run and cannot complete the audit. That's the entire job of the module so it has no choice but to error. In previous versions this was a segfault, which was definitely bad, but now it should be a hard, debug-able error.
> Not sure if it's worth the effort by itself, because the case with pgaudit.log = write would still need another workaround.
You'll need to disable pgAudit in this case. Not sure what else can be done but I'm open to suggestions. FWIW, this was the exact method used in another custom COPY implementation that I'm aware of.
> On TimescaleDB side, I'm considering to make the hook order depend on the order in shared_preload_libraries
I think this would work, if you can manage it. Ideally pgAudit should always be first, or at least it should not be after any extensions that do not propagate the hook chain, i.e. call the the next hook function when they are done.