diff options
author | Etsuro Fujita <efujita@postgresql.org> | 2019-04-02 19:20:30 +0900 |
---|---|---|
committer | Etsuro Fujita <efujita@postgresql.org> | 2019-04-02 19:20:30 +0900 |
commit | ffab494a4d4676a71e830b2d7285eeeb5f2b53d7 (patch) | |
tree | af36b3a1c38ba6099c960d272e864cc7e86d0988 /contrib/postgres_fdw/postgres_fdw.h | |
parent | e2d28c0f404713f564dc2250646551c75172f17b (diff) | |
download | postgresql-ffab494a4d4676a71e830b2d7285eeeb5f2b53d7.tar.gz postgresql-ffab494a4d4676a71e830b2d7285eeeb5f2b53d7.zip |
postgres_fdw: Perform the (ORDERED, NULL) upperrel operations remotely.
The upper-planner pathification allows FDWs to arrange to push down
different types of upper-stage operations to the remote side. This
commit teaches postgres_fdw to do it for the (ORDERED, NULL) upperrel,
which is responsible for evaluating the query's ORDER BY ordering.
Since postgres_fdw is already able to evaluate that ordering remotely
for foreign baserels and foreign joinrels (see commit aa09cd242f et al.),
this adds support for that for foreign grouping relations.
Author: Etsuro Fujita
Reviewed-By: Antonin Houska and Jeff Janes
Discussion: https://postgr.es/m/87pnz1aby9.fsf@news-spur.riddles.org.uk
Diffstat (limited to 'contrib/postgres_fdw/postgres_fdw.h')
-rw-r--r-- | contrib/postgres_fdw/postgres_fdw.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/contrib/postgres_fdw/postgres_fdw.h b/contrib/postgres_fdw/postgres_fdw.h index 3f501032853..e9cbbe62341 100644 --- a/contrib/postgres_fdw/postgres_fdw.h +++ b/contrib/postgres_fdw/postgres_fdw.h @@ -49,6 +49,9 @@ typedef struct PgFdwRelationInfo /* Bitmap of attr numbers we need to fetch from the remote server. */ Bitmapset *attrs_used; + /* True means that the query_pathkeys is safe to push down */ + bool qp_is_pushdown_safe; + /* Cost and selectivity of local_conds. */ QualCost local_conds_cost; Selectivity local_conds_sel; @@ -92,6 +95,9 @@ typedef struct PgFdwRelationInfo /* joinclauses contains only JOIN/ON conditions for an outer join */ List *joinclauses; /* List of RestrictInfo */ + /* Upper relation information */ + UpperRelationKind stage; + /* Grouping information */ List *grouped_tlist; @@ -175,10 +181,14 @@ extern void deparseAnalyzeSql(StringInfo buf, Relation rel, List **retrieved_attrs); extern void deparseStringLiteral(StringInfo buf, const char *val); extern Expr *find_em_expr_for_rel(EquivalenceClass *ec, RelOptInfo *rel); +extern Expr *find_em_expr_for_input_target(PlannerInfo *root, + EquivalenceClass *ec, + PathTarget *target); extern List *build_tlist_to_deparse(RelOptInfo *foreignrel); extern void deparseSelectStmtForRel(StringInfo buf, PlannerInfo *root, RelOptInfo *foreignrel, List *tlist, - List *remote_conds, List *pathkeys, bool is_subquery, + List *remote_conds, List *pathkeys, + bool has_final_sort, bool is_subquery, List **retrieved_attrs, List **params_list); extern const char *get_jointype_name(JoinType jointype); |