diff options
author | Robert Haas <rhaas@postgresql.org> | 2016-01-28 12:05:19 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2016-01-28 12:05:19 -0500 |
commit | 96198d94cb7adc664bda341842dc8db671d8be72 (patch) | |
tree | c488bd043f0dd42d0340acd5eb029b38636a5d72 /contrib/postgres_fdw/postgres_fdw.h | |
parent | 80db1ca2d79338c35bb3e01f2aecad78c2231b06 (diff) | |
download | postgresql-96198d94cb7adc664bda341842dc8db671d8be72.tar.gz postgresql-96198d94cb7adc664bda341842dc8db671d8be72.zip |
Avoid multiple foreign server connections when all use same user mapping.
Previously, postgres_fdw's connection cache was keyed by user OID and
server OID, but this can lead to multiple connections when it's not
really necessary. In particular, if all relevant users are mapped to
the public user mapping, then their connection options are certainly
the same, so one connection can be used for all of them.
While we're cleaning things up here, drop the "server" argument to
GetConnection(), which isn't really needed. This saves a few cycles
because callers no longer have to look this up; the function itself
does, but only when establishing a new connection, not when reusing
an existing one.
Ashutosh Bapat, with a few small changes by me.
Diffstat (limited to 'contrib/postgres_fdw/postgres_fdw.h')
-rw-r--r-- | contrib/postgres_fdw/postgres_fdw.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/contrib/postgres_fdw/postgres_fdw.h b/contrib/postgres_fdw/postgres_fdw.h index 85535360475..59e9f60c04b 100644 --- a/contrib/postgres_fdw/postgres_fdw.h +++ b/contrib/postgres_fdw/postgres_fdw.h @@ -60,8 +60,7 @@ extern int set_transmission_modes(void); extern void reset_transmission_modes(int nestlevel); /* in connection.c */ -extern PGconn *GetConnection(ForeignServer *server, UserMapping *user, - bool will_prep_stmt); +extern PGconn *GetConnection(UserMapping *user, bool will_prep_stmt); extern void ReleaseConnection(PGconn *conn); extern unsigned int GetCursorNumber(PGconn *conn); extern unsigned int GetPrepStmtNumber(PGconn *conn); |