Re: Best Practices for Checking PostgreSQL Server Mode with Multiple Connections

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: YoungUk Song <pidaoh(at)g(dot)skku(dot)edu>, psycopg(at)postgresql(dot)org
Subject: Re: Best Practices for Checking PostgreSQL Server Mode with Multiple Connections
Date: 2024-12-08 17:09:59
Message-ID: 5ed40ad0-5012-48fa-b5c0-61abf7713080@aklaver.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: psycopg

On 12/8/24 04:45, YoungUk Song wrote:
> Hi Team,
>
> I’m currently implementing a solution to establish more than 500
> database connections to a single server to verify whether the PostgreSQL
> server is in read-only or read-write mode.
The server as whole is either in recovery or it is not, that takes one
connection to determine. What are the remaining 499 connections for?

>
> My current approach is to create individual database connections and
> execute the |pg_is_in_recovery()| function for each connection to
> determine the mode.
>
> I’m curious if there are any best practices or more efficient methods to
> achieve this.
>
> Additionally, I’m not very familiar with Psycopg, so I would greatly
> appreciate any advice or suggestions on areas that might need improvement.
>
> Looking forward to your insights!
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message YoungUk Song 2024-12-09 14:04:51 Re: Best Practices for Checking PostgreSQL Server Mode with Multiple Connections
Previous Message YoungUk Song 2024-12-08 12:45:34 Best Practices for Checking PostgreSQL Server Mode with Multiple Connections