As seen in this question setting the
max_standby_archive_delay and the
max_standby_streaming_delay as -1 on a single replica it may cause the replica on long-running queries to have stale data.
So I thought if I had multiple read replicas and use "smart" load balancing using
My idea is somehow to "weight" my replicas by its data freshness, the most recent replicated replica would be chosen first in case that I have long-running queries into another ones.
Therefore, the replicas that run long-running read-only queries would have less chances for any client to connect untill my long-running queries to finish.
So how I can configure the pgpool-II to check which of my replicas has the same version of data with my master and take it into consideration when it load balances my connections?