diff --git a/README.md b/README.md index 6b71ba50..42436913 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![](https://godoc.org/github.com/jackc/pgx?status.svg)](https://godoc.org/github.com/jackc/pgx) -# Pgx - PostgreSQL Driver and Toolkit +# pgx - PostgreSQL Driver and Toolkit ## Version 3 Beta Branch @@ -11,16 +11,15 @@ general release. No further changes are planned, but the beta process may surface desirable changes. If possible API changes are acceptable, then `v3` is the recommended branch for new development. -Pgx is a pure Go database connection library designed specifically for -PostgreSQL. Pgx is different from other drivers such as -[pq](http://godoc.org/github.com/lib/pq) because, while it can operate as a -database/sql compatible driver, pgx is primarily intended to be used directly. -It offers a native interface similar to database/sql that offers better -performance and more features. +pgx is a pure Go driver and toolkit for PostgreSQL. pgx is different from other +drivers such as [pq](http://godoc.org/github.com/lib/pq) because, while it can +operate as a database/sql compatible driver, pgx is primarily intended to be +used directly. It offers a native interface similar to database/sql that offers +better performance and more features. ## Features -Pgx supports many additional features beyond what is available through database/sql. +pgx supports many additional features beyond what is available through database/sql. * pgtype package includes support for approximately 60 different PostgreSQL types - these are usable in pgx native and any database/sql PostgreSQL adapter * Batch queries @@ -45,13 +44,20 @@ Pgx supports many additional features beyond what is available through database/ ## Performance -Pgx performs roughly equivalent to [pq](http://godoc.org/github.com/lib/pq) and -[go-pg](https://github.com/go-pg/pg) for selecting a single column from a single -row, but it is substantially faster when selecting multiple entire rows (6893 -queries/sec for pgx vs. 3968 queries/sec for pq -- 73% faster). +pgx performs roughly equivalent to [go-pg](https://github.com/go-pg/pg) and is +almost always faster than [pq](http://godoc.org/github.com/lib/pq). When parsing +large result sets the percentage difference can be significant (16483 +queries/sec for pgx vs. 10106 queries/sec for pq -- 63% faster). -See this [gist](https://gist.github.com/jackc/d282f39e088b495fba3e) for the -underlying benchmark results or checkout +In many use cases a significant cause of latency is network round trips between +the application and the server. pgx supports query batching to bundle multiple +queries into a single round trip. Even in the case of the fastest possible +connection, a local Unix domain socket, batching as few as three queries +together can yield an improvement of 57%. With a typical network connection the +results can be even more substantial. + +See this [gist](https://gist.github.com/jackc/4996e8648a0c59839bff644f49d6e434) +for the underlying benchmark results or checkout [go_db_bench](https://github.com/jackc/go_db_bench) to run tests for yourself. ## database/sql