2
0
Commit Graph

32 Commits

Author SHA1 Message Date
Jack Christensen f572b336b1 Improve pool Acquire / Release performance
Release was using a goroutine every time. Now it only starts a goroutine
when doing something that may take a while. (Destroy and afterRelease)
2019-05-04 17:36:08 -05:00
Jack Christensen 3661a005fa Per pool.Conn preallocated resources
This removes the pool wide mutexes for preallocated resources.
2019-05-04 16:49:46 -05:00
Jack Christensen 00a1b62e91 Fix name of defaultMaxConns 2019-05-04 15:53:25 -05:00
Jack Christensen 3c7cd51a17 Preallocate poolRows 2019-05-04 15:52:59 -05:00
Jack Christensen d7fdbf1b49 Preallocate poolRow 2019-05-04 15:47:42 -05:00
Jack Christensen dc0cf11399 Bulk allocate pool Conns 2019-05-04 15:40:47 -05:00
Jack Christensen 583c8d3b25 Use pgproto3.FieldDescription instead of pgx version
This allows removing a malloc and memcpy.
2019-05-04 13:47:18 -05:00
Jack Christensen 7558b8d05f Add AfterConnect hook to pool 2019-04-27 16:09:23 -05:00
Jack Christensen 71d8503b81 Remove pool/todo.txt 2019-04-27 10:43:16 -05:00
Jack Christensen 1b124baf7a Add some documentation to pool 2019-04-27 10:42:40 -05:00
Jack Christensen c604afba82 Add pool MaxConnLifetime 2019-04-27 10:25:53 -05:00
Jack Christensen c107ea5831 Default to max pool size of larger of 4 or num cpus 2019-04-27 09:40:17 -05:00
Jack Christensen ac618f105b Add pool AfterRelease hook
Also, just close returned connections that are in a transaction rather
than automatically rolling back.
2019-04-27 09:01:32 -05:00
Jack Christensen 48ea620c93 Add Pool.BeforeAcquire and ConnectConfig 2019-04-27 08:31:23 -05:00
Jack Christensen 27b8876ea3 Add Pool.AcquireAllIdle() 2019-04-27 08:02:52 -05:00
Jack Christensen 46a92b5cd4 Run pool tests parallel 2019-04-25 15:41:17 -05:00
Jack Christensen d93de3fdc7 Add CopyFrom to pool 2019-04-25 15:35:53 -05:00
Jack Christensen 7b1272d254 Add SendBatch to pool 2019-04-25 15:07:35 -05:00
Jack Christensen 00d123a944 Prune methods that delegated to *pgconn.PgConn 2019-04-25 14:25:16 -05:00
Jack Christensen 898925303d Update pool todo 2019-04-24 13:41:05 -05:00
Jack Christensen 2263521f70 Only have a single Begin transaction method 2019-04-24 13:35:27 -05:00
Jack Christensen efb333df6b Fix go modules
Wow. This is fun. Sure is easy to get modules wrong when upgrading a v2+
project.
2019-04-20 17:41:08 -05:00
Jack Christensen ae73ca2da1 Update to more effecient pgconn 2019-04-19 15:55:45 -05:00
Jack Christensen 6c1be9b220 Add pool configuration
MaxConns is only knob at moment
2019-04-13 18:55:02 -05:00
Jack Christensen c53c9e6eb5 Remove simple protocol and one round trip query options
It is impossible to guarantee that the a query executed with the simple
protocol will behave the same as with the extended protocol. This is
because the normal pgx path relies on knowing the OID of query
parameters. Without this encoding a value can only be determined by the
value instead of the combination of value and PostgreSQL type. For
example, how should a []int32 be encoded? It might be encoded into a
PostgreSQL int4[] or json.

Removal also simplifies the core query path.

The primary reason for the simple protocol is for servers like PgBouncer
that may not be able to support normal prepared statements. After
further research it appears that issuing a "flush" instead "sync" after
preparing the unnamed statement would allow PgBouncer to work.

The one round trip mode can be better handled with prepared statements.

As a last resort, all original server functionality can still be accessed by
dropping down to PgConn.
2019-04-13 11:39:01 -05:00
Jack Christensen 0254279df7 Add todos for pool 2019-04-12 16:56:18 -05:00
Jack Christensen 938ee9f434 Rows and Row are now interfaces 2019-04-11 17:58:16 -05:00
Jack Christensen 3e87a8b363 Conn.Close takes context 2019-04-10 14:56:14 -05:00
Jack Christensen 54c6ddc2f0 Commit and Rollback take context
Remove Ex versions.
2019-04-10 12:22:12 -05:00
Jack Christensen 7718ee6207 Remove Ex versions of Query and QueryRow
Always require context and prepend options to arguments if necessary.
2019-04-10 12:12:22 -05:00
Jack Christensen 77a2da2b46 Replace connection pool 2019-04-10 11:09:42 -05:00
Jack Christensen ec10fdde8b Core of new connection pool 2019-04-09 21:32:01 -05:00