RE: "actual time" in QUERY PLAN for parallel operation when loops is bigger than 1

From: "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com>
To: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
Cc: nikolai(dot)berkoff <nikolai(dot)berkoff(at)pm(dot)me>, "pgsql-docs(at)lists(dot)postgresql(dot)org" <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: RE: "actual time" in QUERY PLAN for parallel operation when loops is bigger than 1
Date: 2021-11-17 08:49:34
Message-ID: OS0PR01MB6113C289C98292B04F808B32FB9A9@OS0PR01MB6113.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Wednesday, November 17, 2021 4:19 PM, Guillaume Lelarge guillaume(at)lelarge(dot)info<mailto:guillaume(at)lelarge(dot)info> wrote:
>> -> Parallel Seq Scan on c (cost=0.00..8591.67 rows=416667 width=0) (actual time=0.030..140.036 rows=333333 loops=3)
>In my previous example, actual row number is 333333*3=1e6(which is correct), so I think the actual time is 140.036*3ms.
>Do your think the loops(3) has no meaning for parallel scan node when calculate actual time?
>
>As far as I understand it, you have to multiply the number of rows by the number of loops, but this doesn't apply to duration at least for parallel >queries.

Yes, I got your point.
I’m not familiar with PostgreSQL planner/executor, but if the code is correct, then maybe some modification should be done at [1] as below:

Before:
Multiply by the loops value to get the total time actually spent in the node.

After:
Multiply by the loops value to get the total time actually spent in the node (for node in the parallel portion of the plan, this is not needed).

[1] https://www.postgresql.org/docs/14/using-explain.html

What do you think?

Regards,
Tang

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message PG Doc comments form 2021-11-20 16:12:25 Explicit or implicit?
Previous Message Guillaume Lelarge 2021-11-17 07:18:54 Re: "actual time" in QUERY PLAN for parallel operation when loops is bigger than 1