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 1tKeXS-009zXs-TG for psycopg@arkaria.postgresql.org; Mon, 09 Dec 2024 14:15:06 +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 1tKeXQ-0099jG-Eb for psycopg@arkaria.postgresql.org; Mon, 09 Dec 2024 14:15:05 +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 1tKeXQ-0099j5-85 for psycopg@lists.postgresql.org; Mon, 09 Dec 2024 14:15:05 +0000 Received: from smtp80.iad3b.emailsrvr.com ([146.20.161.80]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tKeXP-001uYk-56 for psycopg@postgresql.org; Mon, 09 Dec 2024 14:15:04 +0000 X-Auth-ID: xof@thebuild.com Received: by smtp19.relay.iad3b.emailsrvr.com (Authenticated sender: xof-AT-thebuild.com) with ESMTPSA id 8B6654027B; Mon, 9 Dec 2024 09:15:01 -0500 (EST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Subject: Re: Best Practices for Checking PostgreSQL Server Mode with Multiple Connections From: Christophe Pettus In-Reply-To: Date: Mon, 9 Dec 2024 06:14:30 -0800 Cc: Adrian Klaver , psycopg@postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <5ed40ad0-5012-48fa-b5c0-61abf7713080@aklaver.com> To: YoungUk Song X-Mailer: Apple Mail (2.3776.700.51) X-Classification-ID: 4342f5b5-1fe9-4bab-8a91-9b668a0176e6-1-1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Dec 9, 2024, at 06:04, YoungUk Song wrote: > Are there any best practices for efficiently handling this task across = such a large number of servers? Out of curiosity, shouldn't something in your infrastructure know this = information already? After all, something created all these servers. That being said, you will need to open connections to the servers to = determine if they are in recovery or not. You might be able to do a = small optimization in that, when you connect, you also query to see what = servers are attached to that server as binary replicas: you can then = remove them from the list of servers that need to be checked, since you = know they are in recovery. If you have cascaded binary replicas, = however, this could end up creating more work than it solves.=