diff options
author | Robert Haas <rhaas@postgresql.org> | 2017-10-06 11:11:10 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2017-10-06 11:11:10 -0400 |
commit | f49842d1ee31b976c681322f76025d7732e860f3 (patch) | |
tree | bc86f11819247980137e89404162ddc88200ac1c /doc/src | |
parent | fe9ba28ee852bb968bc8948d172c6bc0c70c50df (diff) |
Basic partition-wise join functionality.
Instead of joining two partitioned tables in their entirety we can, if
it is an equi-join on the partition keys, join the matching partitions
individually. This involves teaching the planner about "other join"
rels, which are related to regular join rels in the same way that
other member rels are related to baserels. This can use significantly
more CPU time and memory than regular join planning, because there may
now be a set of "other" rels not only for every base relation but also
for every join relation. In most practical cases, this probably
shouldn't be a problem, because (1) it's probably unusual to join many
tables each with many partitions using the partition keys for all
joins and (2) if you do that scenario then you probably have a big
enough machine to handle the increased memory cost of planning and (3)
the resulting plan is highly likely to be better, so what you spend in
planning you'll make up on the execution side. All the same, for now,
turn this feature off by default.
Currently, we can only perform joins between two tables whose
partitioning schemes are absolutely identical. It would be nice to
cope with other scenarios, such as extra partitions on one side or the
other with no match on the other side, but that will have to wait for
a future patch.
Ashutosh Bapat, reviewed and tested by Rajkumar Raghuwanshi, Amit
Langote, Rafia Sabih, Thomas Munro, Dilip Kumar, Antonin Houska, Amit
Khandekar, and by me. A few final adjustments by me.
Discussion: http://postgr.es/m/CAFjFpRfQ8GrQvzp3jA2wnLqrHmaXna-urjm_UY9BqXj=EaDTSA@mail.gmail.com
Discussion: http://postgr.es/m/CAFjFpRcitjfrULr5jfuKWRPsGUX0LQ0k8-yG0Qw2+1LBGNpMdw@mail.gmail.com
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/config.sgml | 20 | ||||
-rw-r--r-- | doc/src/sgml/fdwhandler.sgml | 20 |
2 files changed, 40 insertions, 0 deletions
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index c13f60230f9..b012a269911 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -3632,6 +3632,26 @@ ANY <replaceable class="parameter">num_sync</replaceable> ( <replaceable class=" </listitem> </varlistentry> + <varlistentry id="guc-enable-partition-wise-join" xreflabel="enable_partition_wise_join"> + <term><varname>enable_partition_wise_join</varname> (<type>boolean</type>) + <indexterm> + <primary><varname>enable_partition_wise_join</> configuration parameter</primary> + </indexterm> + </term> + <listitem> + <para> + Enables or disables the query planner's use of partition-wise join, + which allows a join between partitioned tables to be performed by + joining the matching partitions. Partition-wise join currently applies + only when the join conditions include all the partition keys, which + must be of the same data type and have exactly matching sets of child + partitions. Because partition-wise join planning can use significantly + more CPU time and memory during planning, the default is + <literal>off</>. + </para> + </listitem> + </varlistentry> + <varlistentry id="guc-enable-seqscan" xreflabel="enable_seqscan"> <term><varname>enable_seqscan</varname> (<type>boolean</type>) <indexterm> diff --git a/doc/src/sgml/fdwhandler.sgml b/doc/src/sgml/fdwhandler.sgml index a59e03af98b..e63e29fd96f 100644 --- a/doc/src/sgml/fdwhandler.sgml +++ b/doc/src/sgml/fdwhandler.sgml @@ -1292,6 +1292,26 @@ ShutdownForeignScan(ForeignScanState *node); </para> </sect2> + <sect2 id="fdw-callbacks-reparameterize-paths"> + <title>FDW Routines For reparameterization of paths</title> + + <para> +<programlisting> +List * +ReparameterizeForeignPathByChild(PlannerInfo *root, List *fdw_private, + RelOptInfo *child_rel); +</programlisting> + This function is called while converting a path parameterized by the + top-most parent of the given child relation <literal>child_rel</> to be + parameterized by the child relation. The function is used to reparameterize + any paths or translate any expression nodes saved in the given + <literal>fdw_private</> member of a <structname>ForeignPath</>. The + callback may use <literal>reparameterize_path_by_child</>, + <literal>adjust_appendrel_attrs</> or + <literal>adjust_appendrel_attrs_multilevel</> as required. + </para> + </sect2> + </sect1> <sect1 id="fdw-helpers"> |