From: | Robert Haas <rhaas(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Avoid multiple foreign server connections when all use same user |
Date: | 2016-01-28 17:19:29 |
Message-ID: | E1aOqED-0002Pe-JH@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
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.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/96198d94cb7adc664bda341842dc8db671d8be72
Modified Files
--------------
contrib/postgres_fdw/connection.c | 27 +++++++++++++--------------
contrib/postgres_fdw/postgres_fdw.c | 28 ++++++++++------------------
contrib/postgres_fdw/postgres_fdw.h | 3 +--
src/backend/foreign/foreign.c | 1 +
src/include/foreign/foreign.h | 1 +
5 files changed, 26 insertions(+), 34 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2016-01-28 17:23:28 | pgsql: Add missing quotation mark. |
Previous Message | Robert Haas | 2016-01-28 14:37:58 | pgsql: Add [NO]BYPASSRLS options to CREATE USER and ALTER USER docs. |