#2059·pgx

Support libpq compatible load_balance_hosts parameter

Author: pirazCreated Jun 24, 2024Updated Sep 7, 2026

Hello @jackc,

I understand that we can use multiple hosts as described in the question #1184. This is supported by client applications relying on plbpq since PostgreSQL 10.

Do pgx suport/has a similar option as libpq to perform random load balance at client level added to PostgreSQL 16?

The new feature was added to be complaint with the existing JDBC implementation, introducing a new parameter to the connection string called load_balance_hosts, and new env variable PGLOADBALANCEHOST.

The option load_balance_hosts has two options, Disable where libpq will attempt to establish a connection using the host list provided(in order), with no load balancing, and Random providing attempt to connect to a randomly selected host from the list.

Do we have an option like that available currently in the project?

Thank you very much.

See: