Commit Graph

1885 Commits (1dc7133a63b463aec4cf79a19dfa64e38b374211)

Author SHA1 Message Date
Jack Christensen 73d0ac206c
Merge pull request #768 from georgysavva/fix-exposed-config
Fix exposed config
2020-06-06 07:05:13 -05:00
georgysavva e29ce9f6d6 Add Config.Copy() in pgx and pgxpool packages. Conn.Config() and Pool.Config() return copy of the original config. 2020-06-02 13:35:05 +03:00
georgysavva 608451a215 Store original config in Conn before updating it. 2020-06-01 19:38:12 +03:00
Jack Christensen 0e04d8187e Add raw benchmark 2020-06-01 08:53:45 -05:00
Jack Christensen 4b95a747d7 Use pgtype.NewValue instead of reflect for Values()
This is both cleaner and necessary for pgtype.TypeValue types.
2020-05-30 13:32:15 -05:00
Jack Christensen 8dee3382f7 Improve unknown type support for database/sql
- Return unknown type OID instead of empty string for type name.
- ScanType is string instead of empty interface for unknown types.

fixes #759
2020-05-30 13:27:25 -05:00
Jack Christensen 837704dc7d Update stdlib docs to point to Conn.Raw instead of AcquireConn 2020-05-30 13:27:25 -05:00
Jack Christensen 2bd26ec7fa Expose stdlib.Conn.Conn() to enable database/sql.Conn.Raw() 2020-05-30 13:27:25 -05:00
Jack Christensen e6c101413b
Merge pull request #761 from ikozinov/rows-close-logger
Added err field because log output is a bit confusing since it is not clear what error occurred
2020-05-27 08:48:22 -05:00
Igor V. Kozinov 4043edafe7 Add error field to logger on rows close 2020-05-27 14:44:53 +06:00
Jack Christensen 9e1a67c1bc Wait longer in timing sensitive test
Less likely to fail on CI.
2020-05-25 12:04:01 -05:00
Jack Christensen e318c27e26 Merge branch 'jordanlewis-send-batch-simple' 2020-05-25 11:37:52 -05:00
Jack Christensen 72bba7fb42 Move batch simple protocol test to batch_test.go 2020-05-25 11:36:18 -05:00
Jack Christensen 8bad186207 Avoid race between close conn and cancel ctx 2020-05-25 11:35:20 -05:00
Jack Christensen 3ec395d4ef Merge branch 'send-batch-simple' of git://github.com/jordanlewis/pgx into jordanlewis-send-batch-simple 2020-05-25 11:26:16 -05:00
Jack Christensen bcdbb9f657 Tweak benchmarks to account for slow binary formats
See https://www.postgresql.org/message-id/CAMovtNoHFod2jMAKQjjxv209PCTJx5Kc66anwWvX0mEiaXwgmA%40mail.gmail.com
2020-05-25 11:18:11 -05:00
Jordan Lewis 25099e6f89 Permit SendBatch with Simple Protocol
This commit adds support for sending batches of queries via the Simple
protocol with SendBatch. The result appears identically to how it would
if it were created with the extended protocol.
2020-05-25 01:37:48 -04:00
Jack Christensen 8faa1f5096 Fix off by one error with number of rows benchmark 2020-05-16 18:43:22 -05:00
Jack Christensen b19811bbeb Merge branch 'georgysavva-store-connection-string' 2020-05-16 18:14:24 -05:00
Jack Christensen ac6c49c39d Require access to ConnString via Config
A Config object may be created via ParseConfig and then further
modified. Requiring access to the original ConnString via the Config
helps indicate that the Config is the source of truth as to how the
connection was actually established.
2020-05-16 18:12:04 -05:00
Jack Christensen 59a2185dfb Merge branch 'store-connection-string' of git://github.com/georgysavva/pgx into georgysavva-store-connection-string 2020-05-16 18:07:27 -05:00
georgysavva 20c6c44f9f Expose Conn.Config() and Pool.Config(). 2020-05-16 19:53:08 +03:00
georgysavva 33cbec368f rename ConnStr -> ConnString 2020-05-16 19:24:57 +03:00
Jack Christensen 0d82849554 Link directly to geeting started guide 2020-05-16 10:50:30 -05:00
georgysavva 7c73e608ff go mod tidy. 2020-05-16 18:12:22 +03:00
georgysavva a62de87342 Add ConnStr getter to Pool and Conn structs. 2020-05-16 18:10:29 +03:00
Jack Christensen 173227a6e3 Link to wiki from README. 2020-05-16 10:10:07 -05:00
Jack Christensen b1fc2870e5 go mod tidy 2020-05-16 08:21:04 -05:00
Jack Christensen f19b08628e Tweak docs to make conn / conn pool distinction clearer 2020-05-16 08:20:40 -05:00
Jack Christensen 1b54d15e93 Fix documentation error
fixes #749
2020-05-16 07:48:11 -05:00
Jack Christensen c65fd8e2df
Merge pull request #745 from un000/master
Properly close a pool on "not lazy" connect
2020-05-13 12:01:59 -05:00
Yegor Myskin 8dd3679f5a Properly close a pool on "not lazy" connect 2020-05-13 17:48:28 +03:00
Jack Christensen 64789acf46
Merge pull request #734 from georgysavva/stdlib-timeouts
Improve Stdlib context timeouts
2020-05-13 07:45:18 -05:00
Jack Christensen 94ba730bb1 Use simplified pgtype ScanPlan 2020-05-10 14:09:26 -05:00
Jack Christensen 38dd42de4b Support new pgtype format preferences 2020-05-10 14:09:02 -05:00
Jack Christensen aabe5538a8 Optimize large result sets 2020-05-09 23:57:20 -05:00
Jack Christensen e3519cfd75 Document supported versions 2020-05-09 10:24:58 -05:00
Jack Christensen a66b09fbd8 Improve simple protocol / text format
Increased data type support for simple protocol. Improved test
coverage of simple protocol. This has the additional advantage of
exercising the text encoders and decoders.
2020-05-08 16:20:15 -05:00
Jack Christensen c3381c6911 Replace t.Fatal with require where possible 2020-05-08 12:47:47 -05:00
Jack Christensen ec53234e86 Rename ensureConnValid to ensureDBValid 2020-05-08 12:26:24 -05:00
Jack Christensen c44cda4bb4 Clean up old Go 1.10 build tags
pgx requires Go modules which requires at least Go 1.11 so there is no
use in build tags to support older Go versions.
2020-05-08 12:18:09 -05:00
Jack Christensen c03ac1519e Improve stdlib performance with large result sets
In a hot path type assertions are expensive. Cache the already correctly
typed interfaces. ~20% improvement with 1000 rows.

Before:

jack@glados ~/dev/pgx/stdlib ±master » PGX_BENCH_SELECT_ROWS_COUNTS='1 10 1000' got ./... -bench=SelectRows -benchmem
goos: darwin
goarch: amd64
pkg: github.com/jackc/pgx/v4/stdlib
BenchmarkSelectRowsScanSimple/1_rows-16         	   21465	     55060 ns/op	    1679 B/op	      40 allocs/op
BenchmarkSelectRowsScanSimple/10_rows-16        	   16692	     71176 ns/op	    3827 B/op	     148 allocs/op
BenchmarkSelectRowsScanSimple/1000_rows-16      	     800	   1369547 ns/op	  248855 B/op	   12938 allocs/op
BenchmarkSelectRowsScanNull/1_rows-16           	   20306	     57883 ns/op	    1940 B/op	      54 allocs/op
BenchmarkSelectRowsScanNull/10_rows-16          	   15942	     74729 ns/op	    4294 B/op	     171 allocs/op
BenchmarkSelectRowsScanNull/1000_rows-16        	     829	   1326788 ns/op	  261291 B/op	   13051 allocs/op
PASS
ok  	github.com/jackc/pgx/v4/stdlib	10.429s

After:

jack@glados ~/dev/pgx/stdlib ±master » PGX_BENCH_SELECT_ROWS_COUNTS='1 10 1000' got ./... -bench=SelectRows -benchmem
goos: darwin
goarch: amd64
pkg: github.com/jackc/pgx/v4/stdlib
BenchmarkSelectRowsScanSimple/1_rows-16         	   21327	     55097 ns/op	    2127 B/op	      43 allocs/op
BenchmarkSelectRowsScanSimple/10_rows-16        	   16724	     69496 ns/op	    4276 B/op	     151 allocs/op
BenchmarkSelectRowsScanSimple/1000_rows-16      	    1009	   1124573 ns/op	  250037 B/op	   12941 allocs/op
BenchmarkSelectRowsScanNull/1_rows-16           	   20577	     58117 ns/op	    2396 B/op	      57 allocs/op
BenchmarkSelectRowsScanNull/10_rows-16          	   16402	     72533 ns/op	    4750 B/op	     174 allocs/op
BenchmarkSelectRowsScanNull/1000_rows-16        	    1010	   1161437 ns/op	  261735 B/op	   13054 allocs/op
PASS
ok  	github.com/jackc/pgx/v4/stdlib	10.363s
2020-05-08 00:06:42 -05:00
Jack Christensen dea915e605 Compare binary and text format through pgx
Make ID field bigger -- otherwise all ints are less than 4 digits and
get a bit too much of an advantage in text vs. binary
2020-05-07 22:28:46 -05:00
Jack Christensen e439372d2a Add multi-row select benchmarks 2020-05-07 22:28:46 -05:00
Jack Christensen f18351f61c Use ++ instead of += 1 2020-05-07 22:28:46 -05:00
Jack Christensen f9ce8af5c9 Add explicit enum support 2020-05-07 22:28:46 -05:00
Jack Christensen 71fb93a96c Add CopyFrom with enum test 2020-05-07 22:28:46 -05:00
georgysavva e27a6e71b5 Wrap stdlib Conn.Close() and Stmt.Close() with default 5 seconds timeout. 2020-05-02 16:57:39 +03:00
georgysavva e5920c3ad9 Merge branch 'master' of github.com:jackc/pgx 2020-05-02 15:01:11 +03:00
Jack Christensen 3c5d72a8d9
Merge pull request #733 from dchenk/patch-1
Small typo fixed
2020-04-30 19:15:06 -05:00