mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
postgres_fdw: Push down partition-wise aggregation.
Since commit7012b132d0
, postgres_fdw has been able to push down the toplevel aggregation operation to the remote server. Commite2f1eb0ee3
made it possible to break down the toplevel aggregation into one aggregate per partition. This commit lets postgres_fdw push down aggregation in that case just as it does at the top level. In order to make this work, this commit adds an additional argument to the GetForeignUpperPaths FDW API. A matching argument is added to the signature for create_upper_paths_hook. Third-party code using either of these will need to be updated. Also adjust create_foreignscan_plan() so that it picks up the correct set of relids in this case. Jeevan Chalke, reviewed by Ashutosh Bapat and by me and with some adjustments by me. The larger patch series of which this patch is a part was also reviewed and tested by Antonin Houska, Rajkumar Raghuwanshi, David Rowley, Dilip Kumar, Konstantin Knizhnik, Pascal Legrand, and Rafia Sabih. Discussion: http://postgr.es/m/CAM2+6=V64_xhstVHie0Rz=KPEQnLJMZt_e314P0jaT_oJ9MR8A@mail.gmail.com Discussion: http://postgr.es/m/CAM2+6=XPWujjmj5zUaBTGDoB38CemwcPmjkRy0qOcsQj_V+2sQ@mail.gmail.com
This commit is contained in:
@ -359,7 +359,8 @@ void
|
||||
GetForeignUpperPaths(PlannerInfo *root,
|
||||
UpperRelationKind stage,
|
||||
RelOptInfo *input_rel,
|
||||
RelOptInfo *output_rel);
|
||||
RelOptInfo *output_rel,
|
||||
void *extra);
|
||||
</programlisting>
|
||||
Create possible access paths for <firstterm>upper relation</firstterm> processing,
|
||||
which is the planner's term for all post-scan/join query processing, such
|
||||
@ -379,7 +380,11 @@ GetForeignUpperPaths(PlannerInfo *root,
|
||||
currently being considered. <literal>output_rel</literal> is the upper relation
|
||||
that should receive paths representing computation of this step,
|
||||
and <literal>input_rel</literal> is the relation representing the input to this
|
||||
step. (Note that <structname>ForeignPath</structname> paths added
|
||||
step. The <literal>extra</literal> parameter provides additional details,
|
||||
currently, it is set only for <literal>UPPERREL_PARTIAL_GROUP_AGG</>
|
||||
or <literal>UPPERREL_GROUP_AGG</literal>, in which case it points to a
|
||||
<literal>GroupPathExtraData</> structure.
|
||||
(Note that <structname>ForeignPath</structname> paths added
|
||||
to <literal>output_rel</literal> would typically not have any direct dependency
|
||||
on paths of the <literal>input_rel</literal>, since their processing is expected
|
||||
to be done externally. However, examining paths previously generated for
|
||||
|
Reference in New Issue
Block a user