pgsql: postgres_fdw: Consider requesting sorted data so we can do a mer - Mailing list pgsql-committers

From Robert Haas
Subject pgsql: postgres_fdw: Consider requesting sorted data so we can do a mer
Date
Msg-id E1aBS4o-0002l1-Tv@gemulon.postgresql.org
Whole thread Raw
List 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(-)


pgsql-committers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: pgsql: some bullshit
Next
From: Robert Haas
Date:
Subject: pgsql: Comment improvements for abbreviated keys.