pgsql: postgres_fdw: Consider requesting sorted data so we can do a mer

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: postgres_fdw: Consider requesting sorted data so we can do a mer
Date: 2015-12-22 18:54:26
Message-ID: E1aBS4o-0002l1-Tv@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

postgres_fdw: Consider requesting sorted data so we can do a merge join.

When use_remote_estimate is enabled, consider adding ORDER BY to the
query we sending to the remote server so that we can use that ordered
data for a merge join. Commit f18c944b6137329ac4a6b2dce5745c5dc21a8578
arranges to push down the query pathkeys, which seems like the case
mostly likely to be a win, but testing shows this can sometimes win,
too.

For a regular table, we know which indexes are present and therefore
test whether the ordering provided by each such index is useful. Here,
we take the opposite approach: guess what orderings would be useful if
they could be generated cheaply, and then ask the remote side what those
will cost.

Ashutosh Bapat, with very substantial cosmetic revisions by me. Also
reviewed by Rushabh Lathia.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/ccd8f97922944566d26c7d90eb67ab7848ee9905

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 165 ++++++++++++++++
contrib/postgres_fdw/postgres_fdw.c | 238 ++++++++++++++++++++----
contrib/postgres_fdw/sql/postgres_fdw.sql | 40 ++++
src/backend/optimizer/path/pathkeys.c | 5 +-
src/include/optimizer/paths.h | 3 +
5 files changed, 410 insertions(+), 41 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2015-12-22 19:01:35 pgsql: Comment improvements for abbreviated keys.
Previous Message Simon Riggs 2015-12-22 10:57:52 Re: pgsql: some bullshit