Are there any advantages for using one over the other? I'm only looking at options to hide the actual IP address of the master and slave servers from my processes, and not having to restart them if the master fails.

If Nagios detects a failing master, I still want to get involved to do the failover, including telling HAproxy / PgBouncer about the new master.


HAProxy is a low lewel high availability and load balancing solution. PgBouncer combines a very good connection pooler and a very limited load balancing for PostgreSQL.

So both has different goals and can not be compared like "vs" in my opinion. Though they can be used in a combination with each other, eg. if one needs to load balance read only queries between several replicas with HAProxy and these replicas are served by their own PgBouncer instances to get pooling advantages.

More about what PgBouncer is and what it is not in is perfectly described in this blog post.


PgBouncer works at a higher level, mapping N incoming connections to M database connections, whereas HAProxy by nature is a 1:1 mapping. So this provides a line of defence against clients holding idle connections, for example, which isn't possible with HAProxy (at least, not as cleanly, I think).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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