From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: postgres_fdw: Add ORDER BY to some remote SQL queries.
Date: Tue, 03 Nov 2015 18:05:11 +0000
Message-ID: <E1ZtfxH-0001AJ-TN@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
postgres_fdw: Add ORDER BY to some remote SQL queries.
If the join problem's entire ORDER BY clause can be pushed to the
remote server, consider a path that adds this ORDER BY clause. If
use_remote_estimate is on, we cost this path using an additional
remote EXPLAIN. If not, we just estimate that the path costs 20%
more, which is intended to be large enough that we won't request a
remote sort when it's not helpful, but small enough that we'll have
the remote side do the sort when in doubt. In some cases, the remote
sort might actually be free, because the remote query plan might
happen to produce output that is ordered the way we need, but without
remote estimates we have no way of knowing that.
It might also be useful to request sorted output from the remote side
if it enables an efficient merge join, but this patch doesn't attempt
to handle that case.
Ashutosh Bapat with revisions by me. Also reviewed by FabrÃzio de Royes
Mello and Jeevan Chalke.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/f18c944b6137329ac4a6b2dce5745c5dc21a8578
Modified Files
--------------
contrib/postgres_fdw/deparse.c | 56 +++++++++++-
contrib/postgres_fdw/expected/postgres_fdw.out | 64 ++++++++-----
contrib/postgres_fdw/postgres_fdw.c | 116 +++++++++++++++++++++++-
contrib/postgres_fdw/postgres_fdw.h | 3 +
contrib/postgres_fdw/sql/postgres_fdw.sql | 13 ++-
5 files changed, 222 insertions(+), 30 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: postgres_fdw: Add ORDER BY to some remote SQL queries.
In-Reply-To: <E1ZtfxH-0001AJ-TN@gemulon.postgresql.org>
References: <E1ZtfxH-0001AJ-TN@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