Re: PostgreSQL Replication Lag – WALs Streaming but Not Being Applied

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: Simon Musila - Localhost <smusila1(at)gmail(dot)com>
Cc: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: PostgreSQL Replication Lag – WALs Streaming but Not Being Applied
Date: 2026-08-19 12:13:01
Message-ID: aoWdzYaiyNCSZZ6V@depesz.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Tue, Aug 18, 2026 at 09:03:39PM +0300, Simon Musila - Localhost wrote:
> *My questions are:*
> 1. What could cause WALs to be successfully streamed to the standby but
> not applied/replayed?

Concurrent "traffic" (queries). Or special operations in wal that take
"a while" to apply.

> 2. What are the best steps to identify what the WAL replay process is
> waiting on?

I'd start with:
a. `ps uwf -u postgres` shell command (as long as the underlying os is
linux-ish.
b. `select * from pg_stat_activity`
c. `sudo strace -f -tt -T -s 256 -p PID-OF-PG-STARTUP-PROCESS` - again,
on linux hosts
d. pg_waldump of the wal file that takes long time, and check what is
going on there

Best regards,

depesz

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Gyanuba Gyanuba 2026-08-24 15:07:10 Re: Unused Indexes
Previous Message Simon Musila - Localhost 2026-08-18 18:25:52 Re: PostgreSQL Replication Lag – WALs Streaming but Not Being Applied