I have already setup 2 ubuntu server 12.04 LTS on my local machine using virtual box and is using the master-slave replication (postgresql 9.1).

  1. = master
  2. = slave

my question is how to apply the load-balancing based on the two database server? I've heard about pgpool2 and pgbouncer, which one should I use?

Thanks guys and sorry I am new to postgres replication.

1 Answer 1


Of PgBouncer and PgPool-II, only PgPool-II supports load balancing.

PgPool-II's load balancing supports only read-only queries that meet certain requirements; see the pgpool docs. Additionally, if you start load-balancing queries you are no longer guaranteed to get a consistent view of the database because the replica might be lagging behind the master.

Personally, I'd look into adding a caching layer (memcached / Redis) before doing fiddly things like read-query load balancing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.