Best Practices for Checking PostgreSQL Server Mode with Multiple Connections

From: YoungUk Song <pidaoh(at)g(dot)skku(dot)edu>
To: psycopg(at)postgresql(dot)org
Subject: Best Practices for Checking PostgreSQL Server Mode with Multiple Connections
Date: 2024-12-08 12:45:34
Message-ID: CAK9ZnjNECXcXshq6OVzx8ryf0i7KNrp9TErhNkL0ga0c=K-GFA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: psycopg

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.

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!

Responses

Browse psycopg by date

  From Date Subject
Next Message Adrian Klaver 2024-12-08 17:09:59 Re: Best Practices for Checking PostgreSQL Server Mode with Multiple Connections
Previous Message Daniel Johnson 2024-12-06 23:21:10 Re: Parameter in SQL query being misinterpreted