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 1qyaFf-009Jm4-MF for pgsql-admin@arkaria.postgresql.org; Thu, 02 Nov 2023 16:08:59 +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 1qyaFe-00E2Yp-6B for pgsql-admin@arkaria.postgresql.org; Thu, 02 Nov 2023 16:08:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qyaFd-00E2Yh-Ri for pgsql-admin@lists.postgresql.org; Thu, 02 Nov 2023 16:08:57 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qyaFb-003czC-FL for pgsql-admin@lists.postgresql.org; Thu, 02 Nov 2023 16:08:56 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 3A2G8rTr3123997; Thu, 2 Nov 2023 12:08:53 -0400 From: Tom Lane To: Nikhil Shetty cc: Laurenz Albe , Pgsql-admin Subject: Re: statement_timeout has no effect if sync standby is unavailable In-reply-to: References: Comments: In-reply-to Nikhil Shetty message dated "Thu, 02 Nov 2023 21:25:02 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3123995.1698941333.1@sss.pgh.pa.us> Date: Thu, 02 Nov 2023 12:08:53 -0400 Message-ID: <3123996.1698941333@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Nikhil Shetty writes: > I need to check the process state but statement_timeout should timeout such > queries, no? No, I don't think that should be the policy, and if it doesn't do so now I'm content to leave it like that. Once we have committed locally and started to wait for a sync standby, we are between a rock and a hard place: we can't back out the commit. If we were to allow a timeout error to occur, we'd have a choice of reporting that the commit failed (a lie) or that it succeeded (also a lie, given that the promise of sync commit is that we don't report commit until it's persisted on the standby too). Neither of these are preferable to ignoring the timeout. tl;dr: if your standby is not 100% reliable, enabling sync standby is a poor choice. regards, tom lane