pg.ddx.io  pgaudit/pgaudit GitHub issues and pull requests  
help / color / mirror / Atom feed
From: akuzm (@akuzm) <noreply+akuzm@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, 06 Aug 2026 13:20:33 +0000
Message-ID: <gh-pgaudit-pgaudit-300-c5205161448@github.com> (raw)
In-Reply-To: <gh-pgaudit-pgaudit-300@github.com>
References: <gh-pgaudit-pgaudit-300@github.com>

> This has been a bug in certain code paths, but in your case I suspect TimescaleDB may be misusing the hook chain and causing the error. Something in TimescaleDB's COPY/chunk-routing path is likely calling permission checks outside the expected ordering — most likely a per-chunk/per-batch memory context being reset mid-COPY, which fires pgaudit's reset callback and pops the stack item before the check runs.

At the moment it doesn't seem possible to do anything that requires `ExecCheckPermissions` from ProcessUtility hook, unless pgaudit goes first in the hook call sequence. Is this the misuse that you are referring to? Having pgaudit always go first sounds more like a pgaudit-specific requirement to me, it might make sense to document it. I'm not sure if Postgres has an explicit contract on the hook order there, or the extension loading order.  In TimescaleDB, we're running our own implementation of COPY from that hook. It seems that the single ProcessUtility hook w/o explicit ordering guarantees, as provided by Postgres at the moment, is not adequate for making this work reliably.

view thread (12+ messages)  latest in thread

Message-ID: <gh-pgaudit-pgaudit-300-c5205161448@github.com>
Permalink:  ../gh-pgaudit-pgaudit-300-c5205161448@github.com/

 · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox