Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ueg4H-00D9js-Oh for pgsql-general@arkaria.postgresql.org; Wed, 23 Jul 2025 20:28:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ueg4G-004OD3-6d for pgsql-general@arkaria.postgresql.org; Wed, 23 Jul 2025 20:28:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ueg4F-004OCv-SH for pgsql-general@lists.postgresql.org; Wed, 23 Jul 2025 20:28:00 +0000 Received: from vps-90c5819c.vps.ovh.net ([51.68.213.176]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ueg4C-000ThZ-2i for pgsql-general@lists.postgresql.org; Wed, 23 Jul 2025 20:27:59 +0000 Received: from mail-pg1-f176.google.com ([209.85.215.176]) by vps-90c5819c.vps.ovh.net with esmtpa (Exim 4.92) (envelope-from ) id 1ueg4C-0001TJ-57 for pgsql-general@lists.postgresql.org; Wed, 23 Jul 2025 20:27:56 +0000 Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-b3226307787so308581a12.1 for ; Wed, 23 Jul 2025 13:27:56 -0700 (PDT) X-Gm-Message-State: AOJu0YzTzNO2QAUtMPz0CCRPcI1tC8NfrU8dZkqvUcpjHwZJbsjK0VmD BJIU4Hn+GMDuMk9Etxmmjtwp0Euk/24QWO8gR2QIjdhV/p9FFoYAo2ekMBq+WKaF1IJQnamkqKY N3b0FGZYT7vWFnAbj4VDTQ7z/m/tn1dA= X-Google-Smtp-Source: AGHT+IHbgxIaPI+3JVZO4m6UTZFs60cf7kPqIwJgtRhwpC0ow72j+JKAOVVRMy/HfQrQutw0qJq2JgoRJOhgd4t2W4U= X-Received: by 2002:a17:90b:3e89:b0:311:f99e:7f57 with SMTP id 98e67ed59e1d1-31e5082ce7dmr5651013a91.23.1753302475211; Wed, 23 Jul 2025 13:27:55 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Nick Cleaton Date: Wed, 23 Jul 2025 21:27:44 +0100 X-Gmail-Original-Message-ID: X-Gm-Features: Ac12FXxfIZ11lsrC9QCA25JtmbzwePosODfzMwLyjec56sBqjmq5ytE3b9UHn-U Message-ID: Subject: Re: Possible causes of high_replay lag, given replication settings? To: Jon Zeppieri Cc: pgsql-general@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 18 Jul 2025 at 21:29, Jon Zeppieri wrote: > > I just had a situation where physical replication fell far behind > (hours). The write and flush lag times were 0, but replay_lag was > high. The replica has hot_standby_feedback on, and both > max_standby_streaming_delay and max_standby_archive_delay are set to > 30s. > > What could cause a situation like this? If the network were a problem, > I'd expect the other _lag times to be high. So it appears that the > replica was getting the WAL but was unable to apply it. Are there > situations where the replica cannot apply WAL other than the kinds of > conflicts that would be addressed by the _delay settings? > > I checked pg_stat_database_conflicts, but there was nothing in it -- all zeros. This can happen when there are several busy writing processes on the primary. The single replay process on the replica can't keep up with the writes.