summaryrefslogtreecommitdiff
path: root/src/include/foreign
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2015-05-01 08:50:35 -0400
committerRobert Haas <rhaas@postgresql.org>2015-05-01 08:50:35 -0400
commite7cb7ee14555cc9c5773e2c102efd6371f6f2005 (patch)
treefc1d7ab49a9f9eee6027a6ace17c37963e514cc9 /src/include/foreign
parent2b22795b32576fa7173b501b646581a17de35902 (diff)
downloadpostgresql-e7cb7ee14555cc9c5773e2c102efd6371f6f2005.tar.gz
Allow FDWs and custom scan providers to replace joins with scans.
Foreign data wrappers can use this capability for so-called "join pushdown"; that is, instead of executing two separate foreign scans and then joining the results locally, they can generate a path which performs the join on the remote server and then is scanned locally. This commit does not extend postgres_fdw to take advantage of this capability; it just provides the infrastructure. Custom scan providers can use this in a similar way. Previously, it was only possible for a custom scan provider to scan a single relation. Now, it can scan an entire join tree, provided of course that it knows how to produce the same results that the join would have produced if executed normally. KaiGai Kohei, reviewed by Shigeru Hanada, Ashutosh Bapat, and me.
Diffstat (limited to 'src/include/foreign')
-rw-r--r--src/include/foreign/fdwapi.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/include/foreign/fdwapi.h b/src/include/foreign/fdwapi.h
index 1d768412af..c683d9259e 100644
--- a/src/include/foreign/fdwapi.h
+++ b/src/include/foreign/fdwapi.h
@@ -82,6 +82,17 @@ typedef void (*EndForeignModify_function) (EState *estate,
typedef int (*IsForeignRelUpdatable_function) (Relation rel);
+typedef void (*GetForeignJoinPaths_function) (PlannerInfo *root,
+ RelOptInfo *joinrel,
+ RelOptInfo *outerrel,
+ RelOptInfo *innerrel,
+ List *restrictlist,
+ JoinType jointype,
+ SpecialJoinInfo *sjinfo,
+ SemiAntiJoinFactors *semifactors,
+ Relids param_source_rels,
+ Relids extra_lateral_rels);
+
typedef void (*ExplainForeignScan_function) (ForeignScanState *node,
struct ExplainState *es);
@@ -150,10 +161,14 @@ typedef struct FdwRoutine
/* Support functions for IMPORT FOREIGN SCHEMA */
ImportForeignSchema_function ImportForeignSchema;
+
+ /* Support functions for join push-down */
+ GetForeignJoinPaths_function GetForeignJoinPaths;
} FdwRoutine;
/* Functions in foreign/foreign.c */
+extern Oid GetFdwHandlerByRelId(Oid relid);
extern FdwRoutine *GetFdwRoutine(Oid fdwhandler);
extern FdwRoutine *GetFdwRoutineByRelId(Oid relid);
extern FdwRoutine *GetFdwRoutineForRelation(Relation relation, bool makecopy);