On Wed, Jun 24, 2020 at 12:41 PM Maciek Sakrejda <m.sakrejda@gmail.com> wrote:
>
> On Tue, Jun 23, 2020 at 7:55 PM Amit Kapila <amit.kapila16@gmail.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