Ever tried using PostgreSQL’s LISTEN/NOTIFY for real-time features through database/sql? Can’t do it. Want to use COPY for bulk imports that don’t take forever? Nope. Need actual PostgreSQL arrays instead of wrestling with strings? Good luck. This is why pgx exists - it’s built specifically for PostgreSQL instead of pretending every database is the same.

With 13.4k stars, pgx has become the go-to choice for serious PostgreSQL applications in Go. It supports ~70 PostgreSQL types natively, automatically prepares and caches statements, handles binary encoding for performance, and gives you access to PostgreSQL-specific features like bulk COPY operations and pub/sub messaging. The connection pooling is production-ready, it maps PostgreSQL arrays to Go slices naturally, and it even handles large objects and nested transactions with savepoints.

If you’re building a Go app that uses PostgreSQL (not just “some database”), this should be your first choice. The API is clean, the performance beats database/sql significantly, and you get access to PostgreSQL’s actual capabilities instead of the lowest-common-denominator SQL interface. Perfect for everything from high-throughput web services to data processing pipelines that need PostgreSQL’s advanced features.


Stars: 13462
💻 Language: Go
🔗 Repository: jackc/pgx