Open piraz opened 4 months ago
Do we have an option like that available currently in the project?
No, there is not.
Do you think this is a relevant feature to be added to the project?
If yes, should I come with a new ticket or we just set this one a feature request?
Do you think this is a relevant feature to be added to the project?
I think it is a reasonable feature. But it might be a bit tricky to do.
pgx uses FallbackConfig
sto represent all connection attempts that may be made. An
sslmodesuch as
preferas represented as 2 connection attempts that may be made. A host that resolves to multiple IPs is represented as multiple
FallbackConfigs. And when multiple hosts are specified they are represented as
FallbackConfigs. Exactly matching libpq's behavior may be challenging. The simple approach of shuffling the
FallbackConfigs would break
sslmode`prefer
.
Not really sure what a good approach would be.
If yes, should I come with a new ticket or we just set this one a feature request?
Let's use this issue.
Thank you very much.
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 aslibpq
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 newenv
variablePGLOADBALANCEHOST
.The option
load_balance_hosts
has two options,Disable
wherelibpq
will attempt to establish a connection using the host list provided(in order), with no load balancing, andRandom
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: