jackc/pgx
Developer ToolsA pure Go PostgreSQL driver and toolkit for fast, PostgreSQL-specific access from Go applications.
pgx is a pure Go driver and toolkit for PostgreSQL, aimed at Go applications that target PostgreSQL directly and want PostgreSQL-specific behavior without going through the generic database/sql abstraction. Its package reference, connection pooling and database/sql adapter are published alongside the library pgx package docs.
What it does
The base driver gives a low-level interface that exposes PostgreSQL features such as LISTEN/NOTIFY and the COPY protocol. It also handles statement preparation and caching, batch queries, single-round-trip query mode, TLS control, binary encoding for custom types, and mapping for roughly 70 PostgreSQL types, including arrays, json/jsonb, hstore, inet/cidr, and large objects README feature list.
Alongside the driver, the toolkit contains packages that parse the wire protocol and map PostgreSQL and Go types. Those lower-level pieces can be reused to build alternative drivers, proxies, load balancers or logical replication clients, rather than only to run application queries README overview.
Choosing an interface
The project documents two ways to connect. The native pgx interface is faster and is the only one that exposes features like LISTEN/NOTIFY and COPY. The stdlib adapter provides database/sql compatibility, and code can convert a database/sql connection to the lower-level pgx interface when needed interface guidance. For concurrency-safe pooling, the pgxpool package is the documented option pgxpool docs.
A typical workflow is to pass a PostgreSQL connection URL or a key=value connection string, then issue queries through the native API, optionally with a pool; connection settings follow PostgreSQL's connection-string rules connection configuration. A step-by-step walkthrough is available in the project wiki getting started guide.
Requirements and scope
Current support is Go 1.25 and newer and PostgreSQL 14 and newer, tracking the versions supported by the Go and PostgreSQL teams; the project also tests against the latest CockroachDB supported versions. The library follows semantic versioning for the documented public API, and v5 is the latest stable major version version policy. It is MIT-licensed repository.
For contributors, the README describes local PostgreSQL 14–18 clusters and a CockroachDB node, with development setup details in the project's development documentation development notes. That setup is for working on pgx itself; applications only need the normal Go dependency. The README does not present a formal performance benchmark or a migration guide, so choosing between the native and database/sql interfaces is a design decision described above rather than a compatibility guarantee.
Written by AI from the project's README, updated October 29, 2026. The project's own docs are the source of truth.