Does anyone knows what is the difference between built in connection pool (inside http://golang.org/pkg/database/sql/), and solutions like pgpool/pgbouncer. Does it make sense to combine them? Which one should be better in terms of performance? Which one do you prefer, and why?
Thanks!
评论:
kron4eg:
nathj07:Using pgpool/pgbouncer makes sense even with built on connection pool, since pgpool/pgbouncer are like gateway to your database, they guard it from hitting "too many connections".
elithrar_:I've used both together. There is one gotcha with using pgbouncer. Go seems to wrap SQL in prepared statements if there are placeholder values. Depending on your pgbouncer configuration this may require the explicit use of transactions. This is true even of select statements.
Just a heads up.
pgpool & pgbouncer do a lot more than just pooling client connections to a single DB - they can manage pooling to multiple DB servers and/or parallel querying.
