Re: EXPLAIN: Non-parallel ancestor plan nodes exclude parallel worker instrumentation

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Maciek Sakrejda <m(dot)sakrejda(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: EXPLAIN: Non-parallel ancestor plan nodes exclude parallel worker instrumentation
Date: 2020-06-24 09:07:36
Message-ID: CAA4eK1+9=ihNGMp7twnu-DJh=tMT_s7PNmyeXUbdEgeqb7zzQw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 24, 2020 at 12:41 PM Maciek Sakrejda <m(dot)sakrejda(at)gmail(dot)com> wrote:
>
> On Tue, Jun 23, 2020 at 7:55 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> > > I don't see any other reason for
> > > looping over the NL node itself in this plan. The Gather itself
> > > doesn't do any real looping, right?
> >
> > It is right that Gather doesn't do looping but Parallel Seq Scan node does so.
>
> Sorry, I still don't follow. How does a Parallel Seq Scan do looping?

Sorry, I intend to say that Parallel Seq Scan is involved in looping.
Let me try by example:

Gather (actual time=6.444..722.642 rows=10000 loops=1)
Workers Planned: 2
Workers Launched: 2
-> Nested Loop (actual time=0.046..705.936 rows=5000 loops=2)
-> Parallel Seq Scan on t1 (actual time=0.010..45.423
rows=250000 loops=2)
-> Index Scan using idx_t2 on t2 (actual time=0.002..0.002
rows=0 loops=500000)
Index Cond: (c1 = t1.c1)

In the above plan, each of the worker runs
NestLoop
-> Parallel Seq Scan on t1
-> Index Scan using idx_t2 on t2

So, that leads to loops as 2 on "Parallel Seq Scan" and "Nested Loop"
nodes. Does this make sense now?

> I looked at the parallel plan docs but I don't see looping mentioned
> anywhere[1]. Also, is looping not normally indicated on children,
> rather than on the node doing the looping? E.g., with a standard
> Nested Loop, the outer child will have loops=1 and the inner child
> will have loops equal to the row count produced by the outer child
> (and the Nested Loop itself will have loops=1 unless it also is being
> looped over by a parent node), right?
>

Yeah, I hope the above has clarified it.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2020-06-24 09:07:45 Re: min_safe_lsn column in pg_replication_slots view
Previous Message Bruce Momjian 2020-06-24 09:06:28 Re: Default setting for enable_hashagg_disk