Re: Query with high planning time at version 11.1 compared versions 10.5 and 11.0

From: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
To: alvherre(at)2ndquadrant(dot)com
Cc: Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp, pryzby(at)telsasoft(dot)com, sanyo(dot)moura(at)tatic(dot)net, jeff(dot)janes(at)gmail(dot)com, david(dot)rowley(at)2ndquadrant(dot)com, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-performance(at)lists(dot)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Query with high planning time at version 11.1 compared versions 10.5 and 11.0
Date: 2018-12-07 05:43:45
Message-ID: CAExHW5umxU5FOoT8FBcqp-GWKMtZhnuEy7U6bNH8QfzvYwUgEQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

On Thu, Dec 6, 2018 at 1:27 PM Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
wrote:

> On 2018-Dec-06, Amit Langote wrote:
>
> > The partitionwise join related
> > changes in PG 11 moved the add_child_rel_equivalences call in
> > set_append_rel_size such that child EC members would be added even before
> > checking if the child rel is dummy, but for a reason named in the comment
> > above the call:
> >
> > ... Even if this child is
> > * deemed dummy, it may fall on nullable side in a child-join, which
> > * in turn may participate in a MergeAppend, where we will need the
> > * EquivalenceClass data structures.
> >
> > However, I think we can skip adding the dummy child EC members here and
> > instead make it a responsibility of partitionwise join code in joinrels.c
> > to add the needed EC members. Attached a patch to show what I mean,
> which
> > passes the tests and gives this planning time:
>
> Robert, Ashutosh, any comments on this? I'm unfamiliar with the
> partitionwise join code.
>

As the comment says it has to do with the equivalence classes being used
during merge append. EC's are used to create pathkeys used for sorting.
Creating a sort node which has column on the nullable side of an OUTER join
will fail if it doesn't find corresponding equivalence class. You may not
notice this if both the partitions being joined are pruned for some reason.
Amit's idea to make partition-wise join code do this may work, but will add
a similar overhead esp. in N-way partition-wise join once those equivalence
classes are added.

--
Best Wishes,
Ashutosh Bapat

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-12-07 06:26:58 Re: Strange OSX make check-world failure
Previous Message Iwata, Aya 2018-12-07 05:24:46 RE: libpq debug log

Browse pgsql-performance by date

  From Date Subject
Next Message Ashutosh Bapat 2018-12-07 11:14:14 Re: Query with high planning time at version 11.1 compared versions 10.5 and 11.0
Previous Message Alvaro Herrera 2018-12-06 07:57:26 Re: Query with high planning time at version 11.1 compared versions 10.5 and 11.0