From: | Alastair Turner <minion(at)decodable(dot)me> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Extensibility proposal - transaction start callbacks |
Date: | 2025-01-28 16:31:39 |
Message-ID: | CAC0GmyzrT8m4mgvnScNJkcrMzwu41fOqf5LTLSmbZZeizk6-MQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I see that various comments in xact.c talk about start and end callbacks,
but only end seems to be implemented at the moment. I also can't find any
discussion about start of transaction callbacks in the mailing list
archives. Would a patch in this direction be of interest?
I was looking at this based on the discussion around extended transaction
logging for audit tools [1], there is another possible use of this session
information - in logical replication. There is a pattern among the users of
various logical replication / CDC of using user identity, application
identity or session flags as a way to suppress the logical replication of
some transactions. The primary interest seems to be in suppressing the
logical replication of bulk load or bulk update operations which are
dual-loaded into the two databases from a common source.
The existing infrastructure of XactCallback and pg_logical_emit_message()
seems to provide what's needed to tie this together, but only at the end
(COMMIT, ROLLBACK, PREPARE) of a transaction. It would be great for the
logical replication plugin to be able to make a decision at the start of a
large transaction to discard the transaction's content before incurring the
cost of staging the content and/or rolling back.
Thanks
Alastair
From | Date | Subject | |
---|---|---|---|
Next Message | Vladlen Popolitov | 2025-01-28 16:45:47 | Re: Increase of maintenance_work_mem limit in 64-bit Windows |
Previous Message | jian he | 2025-01-28 16:24:59 | Re: Extended Statistics set/restore/clear functions. |