Missing empty transaction optimization in pgoutput plugin

From: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Tomas Vondra <tomas(at)vondra(dot)me>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Subject: Missing empty transaction optimization in pgoutput plugin
Date: 2025-12-08 06:48:55
Message-ID: CAExHW5tSVyf7fjaCF4jk4swvwzO-hZp=wvOHXthmaMDWtc0eGA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi All,
test_decoding output plugin skips sending stream_start and stream_end
if no change from a segment of a streamed transaction is sent
downstream. If no change has been sent downstream across all the
streamed segments it doesn't send commit or abort for that streamed
transaction. But I don't see similar changes in stream related
callbacks in pgoutput output plugin.

While the changes discussed in thread [1] were committed, those didn't
include this optimization for test_decoding plugin as well. The
optimization was discussed in [2] separately as a bug fix. Maybe
because it wasn't considered as an optimization that time, we may not
have considered it for pgoutput plugin which doesn't have explicit
skip-empty-xacts option. I think the optimization would be useful in
setups where multiple publications and long transactions are common.
Any reason not to have it.

[1] https://www.postgresql.org/message-id/flat/688b0b7f-2f6c-d827-c27b-216a8e3ea700%402ndquadrant.com
[2] https://www.postgresql.org/message-id/flat/CAA4eK1%2BOqgFNZkf7%3DETe_y5ntjgDk3T0wcdkd4Sot_u1hySGfw%40mail.gmail.com
--
Best Wishes,
Ashutosh Bapat

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Soumya S Murali 2025-12-08 07:14:33 Re: Checkpointer write combining
Previous Message cca5507 2025-12-08 06:46:40 Re: Support loser tree for k-way merge