Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read PostgreSQL wal file data? Is there is any command to convert PostgreSQL binary to readable text format?

I am trying to read PostgreSQL wal file. Its a binary file and I am not able to read wal file data in text format. Can anyone help me for this. Is there any command or something to read the wal file data?

like image 430
Rahul Tiwari Avatar asked Apr 24 '19 10:04

Rahul Tiwari


1 Answers

Generally, there are two options in Postgres for presenting WALs in some human-readable format:

  1. pg_waldump utility, but it is available only in 9.3+. You can try using pg_waldump from 9.3 with 9.2 WALs, but I am not sure in success. It may work, since there should not be any new WAL record types in 9.2, which do not exist in 9.3. Note: pg_waldump was called pg_xlogdump until Postgres 10.0
  2. Also it is possible to utilize logical decoding, but it is available since 9.4. Anyway, with logical decoding one can use various plugins like wal2json to export records in the human-readable format. Note: logical decoding may do not decode every WAL record, it is mostly about DML (insert/update/delete)

Thus, I would strongly recommend to upgrade your cluster to Postgres 9.4 at least.

like image 194
ololobus Avatar answered Nov 15 '22 03:11

ololobus