Re: Avoid logging dropped TOAST values with REPLICA IDENTITY FULL

From: Rui Zhao <zhaorui126(at)gmail(dot)com>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Avoid logging dropped TOAST values with REPLICA IDENTITY FULL
Date: 2026-12-05 15:53:40
Message-ID: CAHWVJhHOPtSO9y_qmqfDDTC072Mm2rk8f2+TPaO55Lp1yFeu5Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Álvaro,

Thanks for reviewing the patch.

> Hmm, I wonder in what cases do we need to log values in dropped columns.
> Shouldn't we do it unconditionally?

If the column was already dropped when the UPDATE or DELETE ran, I
don't see a reason to log its value in the old row.

I focused on external values because some of the values I saw in
production were hundreds of MB each. ExtractReplicaIdentity() already
rebuilds the old tuple when it contains a TOAST pointer. Skipping a
dropped value there avoids fetching it from TOAST and writing it to WAL.

When all values are inline, ExtractReplicaIdentity() returns the
original tuple, so we can log the old row without deforming it. With
the default 8 KB page size, the whole tuple has to fit on one page.
Given that limit, I didn't think it was worth rebuilding the tuple
just to leave a dropped inline field out of WAL.

Regards,
Rui

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message shihao zhong 2026-12-05 15:55:25 Re: Printing backtrace of postgres processes
Previous Message shihao zhong 2026-12-05 15:33:32 Re: VACUUM FULL / REPACK on the primary make hot standby queries miss rows (2012 report, still unfixed)