Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mGx6E-0004Kc-22 for pgsql-general@arkaria.postgresql.org; Fri, 20 Aug 2021 05:29:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mGx6C-0005x1-TQ for pgsql-general@arkaria.postgresql.org; Fri, 20 Aug 2021 05:29:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mGx6C-0005wt-Bu for pgsql-general@lists.postgresql.org; Fri, 20 Aug 2021 05:29:48 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mGx65-0001fU-7r for pgsql-general@lists.postgresql.org; Fri, 20 Aug 2021 05:29:47 +0000 Received: by mail-wr1-x42f.google.com with SMTP id f5so12289258wrm.13 for ; Thu, 19 Aug 2021 22:29:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=vh2WoyUPnUHdFTKt+vUZ0WAU1rLagfTDRBz9IbbfHs8=; b=fRwvFAY9rlvIRaVMBLWh4DlaebsTzpx7dtu4qAyEcZJmYoTNqaHU8tp/a1Wh+zinWe hegj383oQrzdcKSwG5tZojhVpNVtBOkm+ngygkZiT0rIxSeOoLBQk9vdyVOPbnnfpdf5 TONW1zevrevFS79onakP+4UKgzZb+XHxAAWpZfKRUqwkiL0VFGZ3/ZfPTejx3Ho4GCTd k8DVBvYQ8UxZVY6pllFyUI3gZ/p1lPA/QbX69vHkOTB28OD595d4dSYNsDIW3EFX0XFK 28ZbPzPzrpjLwsmQ5sUclJ9UFUisDEtXcFFaMtR/xqBL+qr4uUrVJg2Sai0dCXKJuL7j fxqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=vh2WoyUPnUHdFTKt+vUZ0WAU1rLagfTDRBz9IbbfHs8=; b=rZoXyR/hMGWzeV3p5s7Wa6z5P7ltVCqei/SbWlsWcGfxmOyZOxlScK8WNUIEKpZjDl A9ygUR2gwBjUDuftPwEr5sTkipAoHVmitQWUGxDglpqg4czVvp/TOixOXKI/gcq2DOFf xAYov5zi0M8bhqnat5McOAMu6JlvZaclp4tY+8O7AiJBhBcEsBiMAVqO3tuP5CuJ6TZ8 U9RXL3f7QuByeo+m5BrUiyW6M5Ll3fFnMxM0ZD3Tf+v/2nnW+qLIaiK8VywNznPORuyJ 3jjNZERtTP0e3u0SOYIh73Sy/x6Zf+dWkeFh9SUZG3iFIf8OWDttUlmMe9diBBNwLqJZ PD9w== X-Gm-Message-State: AOAM531kBzU6QkTKk/bTEwS4CoAkHwPEnQWOGGP7QnPAmIj3Tt0iooZ3 hLwQbr7sLDThHF1jmbM449l6fhwRKNtBmw== X-Google-Smtp-Source: ABdhPJzupPXtZ2ceTGBzBKdo9buNYaWlVXkpSqHLyjrC76Z9BZ4Czr8rHMrBdF1rgPkvtJuGSw9SMQ== X-Received: by 2002:a5d:60cd:: with SMTP id x13mr7567756wrt.375.1629437379247; Thu, 19 Aug 2021 22:29:39 -0700 (PDT) Received: from localhost.localdomain (178-190-183-37.adsl.highway.telekom.at. [178.190.183.37]) by smtp.gmail.com with ESMTPSA id w14sm4717241wrt.23.2021.08.19.22.29.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 22:29:38 -0700 (PDT) Message-ID: <4b9178e5ffeb33e7f6409f204846053623fc280a.camel@cybertec.at> Subject: Re: PostgreSQL 9.2 high replication lag From: Laurenz Albe To: Lucas Cc: "pgsql-general@lists.postgresql.org" Date: Fri, 20 Aug 2021 07:29:38 +0200 In-Reply-To: References: <0d5784f69c8f3b61523917b7ee5ea12a042bf478.camel@cybertec.at> <9IUyTDCTXb7OhMjGR1ng9s6dxMnIilFs9w0rdKEQWOhWB0SWt-GqiJML-YNZadtZrnppAp0B5aCpY3HZcWvWSMrGEFOLIncUtj2BYm8qOUs=@sud0.nz> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2021-08-20 at 01:33 +0000, Lucas wrote: > After setting max_standby_streaming_delay to 120s it got a lot better. > But the replication delay is still happening quite often, except this time goes up to 120s only. That's exactly what this parameter should do. If you don't want the delays, either reduce the value (and get more canceled queries) or try to reduce the number of conflicts, for example by setting "hot_standby_feedback = on". Note that you will never be able to completely get rid of replication colflicts; for example, there are buffer pin conflicts or lock conflicts caused by autovacuum truncation. See this article for more: https://www.cybertec-postgresql.com/en/streaming-replication-conflicts-in-postgresql/ If you want a standby that has no apply delays and no canceled queries is usually not possible. Consider using two standby servers for these two purposes. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com