From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Avoid multiple foreign server connections when all use same user
Date: Thu, 28 Jan 2016 17:19:29 +0000
Message-ID: <E1aOqED-0002Pe-JH@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: rhaas@postgresql.org
Subject: Re: pgsql: Avoid multiple foreign server connections when all use same user
In-Reply-To: <E1aOqED-0002Pe-JH@gemulon.postgresql.org>
References: <E1aOqED-0002Pe-JH@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox