Re: pg_waldump

From: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
To: Fabrice Chapuis <fabrice636861(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_waldump
Date: 2023-12-19 13:00:07
Message-ID: CAEze2Wgu+4dtNpTy+_7LDTf5F_exdYrrQd1iZ14iYSvmDNmeAg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 19 Dec 2023, 12:27 Fabrice Chapuis, <fabrice636861(at)gmail(dot)com> wrote:
>
> Hi,
> Is it possible to visualize the DDL with the pg_waldump tool. I created a postgres user but I cannot find the creation command in the wals

Not really, no. PostgreSQL does not log DDL or DML as such in WAL.
Essentially all catalog updates are logged only as changes on a
certain page in some file: a new user getting inserted would be
approximately "Insert tuple [user's pg_role row data] on page X in
file [the file corresponding to the pg_role table]".

You could likely derive most DDL commands from Heap/Insert,
Heap/Delete, and Heap/Update records (after cross-referencing the
database's relfilemap), as most DDL is "just" a lot of in-memory
operations plus some record insertions/updates/deletes in catalog
tables. You'd also need to keep track of any relfilemap changes while
processing the WAL, as VACUUM FULL on the catalog tables would change
the file numbering of catalog tables...

Kind regards,

Matthias van de Meent
Neon (https://neon.tech)

In response to

  • pg_waldump at 2023-12-19 11:26:54 from Fabrice Chapuis

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2023-12-19 13:05:17 RE: Synchronizing slots from primary to standby
Previous Message Christophe Pettus 2023-12-19 12:54:32 Re: logical decoding and replication of sequences, take 2