Re: Explain buffers wrong counter with parallel plans

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Adrien Nayrat <adrien(dot)nayrat(at)anayrat(dot)info>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Explain buffers wrong counter with parallel plans
Date: 2018-07-07 02:15:41
Message-ID: CAA4eK1L0KAZWgnRJz=VNVpyS3FFbVh8E5egyziaR0E10bC204Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Jul 7, 2018 at 12:44 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Fri, Jul 6, 2018 at 9:44 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>> I have tried this idea, but it doesn't completely solve the problem.
>> The problem is that nodes below LIMIT won't get a chance to accumulate
>> the stats as they won't be able to call InstrStopNode.
>
> I'm not sure I understand. Why not? I see that we'd need to insert
> an extra call to InstrStopNode() if we were stopping the node while it
> was running, because then InstrStartNode() would have already been
> done, but the corresponding call to InstrStopNode() would not have
> been done. But I'm not sure how that would happen in this case. Can
> you explain further?
>

Okay, let me try. The code flow is that for each node we will call
InstrStartNode()->ExecProcNodeReal()->InstrStopNode(). Now let's say
we have to execute a plan Limit->Gather-> Parallel SeqScan. In this,
first for Limit node, we will call InstrStartNode() and
ExecProcNodeReal() and then for Gather we will call InstrStartNode(),
ExecProcNodeReal() and InstrStopNode(). Now, Limit node decides that
it needs to shutdown all the nodes (ExecShutdownNode) and after that
it will call InstrStopNode() for Limit node. So, in this flow after
shutting down nodes, we never get chance for Gather node to use stats
collected during ExecShutdownNode.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Brent Kerby 2018-07-07 03:03:59 Transition relations: correlating OLD TABLE and NEW TABLE
Previous Message Larry Rosenman 2018-07-07 00:53:23 Re: peripatus build failures....