Re: explain analyze output with parallel workers - question about meaning of information for explain.depesz.com

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Hubert Lubaczewski <depesz(at)depesz(dot)com>, pgsql-hackers mailing list <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain analyze output with parallel workers - question about meaning of information for explain.depesz.com
Date: 2017-12-02 13:04:47
Message-ID: CAA4eK1J7XJ6Cw2jvgNTH1vkeTxGOWtuk+Y2r2P1H3Tn33cZ_DQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Nov 29, 2017 at 2:04 PM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> On Tue, Nov 28, 2017 at 9:42 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> On Tue, Nov 28, 2017 at 2:23 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>>> That is wrong and I think you have hit a bug. It should be 2974 * 5 =
>>> 14870 as you have seen in other cases. The problem is that during
>>> rescan, we generally reinitialize the required state, but we forgot to
>>> reinitialize the instrumentation related memory which is used in the
>>> accumulation of stats, so changing that would fix some part of this
>>> problem which is that at Parallel node, you won't see wrong values.
>>> However, we also need to ensure that the per-worker details also get
>>> accumulated across rescans. Attached patch should fix the problem you
>>> are seeing. I think this needs some more analysis and testing to see
>>> if everything works in the desired way.
>>>
>>> Is it possible for you to test the attached patch and see if you are
>>> still seeing any unexpected values?
>>
>> FWIW, this looks sensible to me. Not sure if there's any good way to
>> write a regression test for it.
>>
>
> I think so, but not 100% sure. I will give it a try and report back.
>

Attached patch contains regression test as well. Note that I have
carefully disabled all variable stats by using (analyze, timing off,
summary off, costs off) and then selected parallel sequential scan on
the right of join so that we have nloops and rows as variable stats
and those should remain constant.

--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
fix_accum_instr_parallel_workers_v2.patch application/octet-stream 4.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2017-12-02 15:04:52 Re: [HACKERS] Custom compression methods
Previous Message Beena Emerson 2017-12-02 08:33:22 Re: [HACKERS] Runtime Partition Pruning