Re: [HACKERS] advanced partition matching algorithm for partition-wise join

amul sul <sulamul@gmail.com>

From: amul sul <sulamul@gmail.com>
To: Etsuro Fujita <etsuro.fujita@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Thomas Munro <thomas.munro@gmail.com>, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>, Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, Rajkumar Raghuwanshi <rajkumar.raghuwanshi@enterprisedb.com>, Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>, Dmitry Dolgov <9erthalion6@gmail.com>, Antonin Houska <ah@cybertec.at>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2019-11-05T13:14:50Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Suppress unused-variable warning.

  2. Allow partitionwise joins in more cases.

  3. Avoid crash in partitionwise join planning under GEQO.

  4. Disable support for partitionwise joins in problematic cases.

  5. Add plan_cache_mode setting

  6. Add test for partitionwise join involving default partition.

  7. Revise API for partition_rbound_cmp/partition_rbound_datum_cmp.

Attachments

On Fri, Nov 1, 2019 at 3:58 PM Etsuro Fujita <etsuro.fujita@gmail.com>
wrote:

> On Thu, Oct 31, 2019 at 6:49 PM Etsuro Fujita <etsuro.fujita@gmail.com>
> wrote:
> > Attached is an updated version.  If no objections, I'll merge this
> > with the main patch [1].
>
> Done.  Attached is a new version of the patch.
>
> Other changes: in generate_matching_part_pairs(), I changed variable
> names to match other functions, simplified assertions, and
> adjusted/added comments a bit.
>

Thanks for the update version.

A query and comments for v25:

583 + * The function returns NULL if we can not find the matching pair of
 584 + * partitions. This happens if 1. multiple partitions on one side
match with
 585 + * one partition on the other side. 2. a given partition on the outer
side
 586 + * doesn't have a matching partition on the inner side. We can not
support the
 587 + * first case since we don't have a way to represent multiple
partitions as a
 588 + * single relation (RelOptInfo) and then perform join using the ganged
 589 + * relation. We can not support the second case since the missing
inner
 590 + * partition needs to be represented as an empty relation and we
don't have a
 591 + * way to introduce empty relation during join planning after
creating paths
 592 + * for all the base relations.
 593 + */
 594 +PartitionBoundInfo
 595 +partition_bounds_merge(int partnatts,

I think the second condition mention for partition_bounds_merge() looks
outdated, do you think we should remove that or am I missing something here?
---

1768 +
1769 +       /*
1770 +        * If this is an outer join, the merged partition would act as
the
1771 +        * default partition of the join; record the index in
*default_index
1772 +        * if not done yet.
1773 +        */
1774 +       if (jointype == JOIN_LEFT || jointype == JOIN_ANTI ||
1775 +           jointype == JOIN_FULL)
1776 +       {

As decided need to replace this list by IS_OUTER_JOIN(jointype).
---

2020 +       if (jointype == JOIN_LEFT || jointype == JOIN_FULL ||
2021 +           jointype == JOIN_ANTI)
2022 +       {

Same as the previous.
---

I tried a coverage testing and tried to adjust & add a few tests to
improved the
code coverage for the v25 patch. Please have a look at the attached 0002 &
also
attach the coverage output with & without this patch, TWIMW.

0001 is the same v25 patch, reattaching to make CFbot happy.

Regards,
Amul