public inbox for [email protected]  
help / color / mirror / Atom feed
From: Kashif Zeeshan <[email protected]>
To: Atul Kumar <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: Wal file query
Date: Tue, 8 Apr 2025 17:01:38 +0500
Message-ID: <CAAPsdhdgwy4rgSUXAf_b+QVMtFyX2mKbfy6UwP=p824OWeMTBw@mail.gmail.com> (raw)
In-Reply-To: <CA+ONtZ52vAaES6YPvAmXDrMcbdxtzKCJQbMJSdAFM4vp6RCFTA@mail.gmail.com>
References: <CA+ONtZ52vAaES6YPvAmXDrMcbdxtzKCJQbMJSdAFM4vp6RCFTA@mail.gmail.com>

Hi Atul

Start by looking at the current WAL LSN and insert LSN. The
pg_current_wal_lsn is the location of the last write. The
pg_current_wal_insert_lsn is the logical location and reflects data in the
buffer that has not been written to disk. There is also a flush value that
shows what has been written to durable storage.

[postgres] # select pg_current_wal_lsn(), pg_current_wal_insert_lsn();
 pg_current_wal_lsn | pg_current_wal_insert_lsn
--------------------+---------------------------
 76/7D000000        | 76/7D000028
(1 row)

Although you can guess the name of the WAL file based on the above
output, it is best to use the pg_walfile_name function.


[postgres] # select pg_walfile_name('76/7D000028');
     pg_walfile_name
--------------------------
 00000001000000760000007D
(1 row)


For details visit following link :
https://www.crunchydata.com/blog/postgres-wal-files-and-sequuence-numbers


Thanks

Kashif Zeeshan



On Tue, Apr 8, 2025 at 4:44 PM Atul Kumar <[email protected]> wrote:

> In streaming replication What is the way to check which "WAL file" is
> currently in use in primary  and in standby ?
>
>
> Regards.
>


view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Wal file query
  In-Reply-To: <CAAPsdhdgwy4rgSUXAf_b+QVMtFyX2mKbfy6UwP=p824OWeMTBw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox