mirror of
https://github.com/postgres/postgres.git
synced 2025-10-19 15:49:24 +03:00
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.
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user