What's the recommended approach to connection pooling?

Does anyone have advice on what they are using to do connection pooling with CockroachDB? According to Connection Pooling | CockroachDB Docs it looks like I can use the “pgx” library to do connection pooling.

I’ve also seen pgBouncer being brought up as a solution as well (for Postgres databases in general).

What are the downsides to using “pgx” vs “pgBouncer”? Thanks for any info/advice!

Hi! You should be able to use any connection pool library. Most languages have some sort of connection pool available. As you said, if you’re using Go, you can use pgxpool. With java you could use hikaricp. pgbouncer is another option, which you can use regardless of the language your application is written in. Since that runs as a separate process it is more overhead to set up and configure.

For most situations, I’d say that using an in-process connection pool like pgxpool is a better choice to start off with.