Re: Query related to Logical Replication using test_decoding and unchanged-toast-datum

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Kiran K V <kirankv(dot)1982(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Query related to Logical Replication using test_decoding and unchanged-toast-datum
Date: 2025-01-06 16:37:20
Message-ID: CAKFQuwYYpyv_qqLXLKPqTKeY74bUR9XMXzAgUh=OPxYLqn=Ssw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jan 6, 2025 at 7:21 AM Kiran K V <kirankv(dot)1982(at)gmail(dot)com> wrote:

> could you please tell me whether PostgreSQL will truly log these values to
> WAL or not ? If not, what will be entered into WAL for the JSON column if
> it remains unchanged?
>
>
Not quite sure what you are looking for but:

https://www.postgresql.org/docs/current/storage-toast.html#STORAGE-TOAST-ONDISK

"A pointer datum representing an out-of-line on-disk TOASTed value
therefore needs to store the OID of the TOAST table in which to look and
the OID of the specific value (its chunk_id). For convenience, pointer
datums also store the logical datum size (original uncompressed data
length), physical stored size (different if compression was applied), and
the compression method used, if any. Allowing for the varlena header bytes,
the total size of an on-disk TOAST pointer datum is therefore 18 bytes
regardless of the actual size of the represented value."

So the WAL of the main table data will contain 18bytes of data for that
column. If the toast data really hasn't changed during the period in
question the WAL will not contain any data for the toast relation since no
changes to it were made.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2025-01-06 16:47:55 Re: Questions about the Debian Package version of pgAdmin
Previous Message Kiran K V 2025-01-06 14:19:47 Query related to Logical Replication using test_decoding and unchanged-toast-datum