Re: [bug?] EXPLAIN outputs 0 for rows and width in cost estimate for update nodes

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: "tsunakawa(dot)takay(at)fujitsu(dot)com" <tsunakawa(dot)takay(at)fujitsu(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [bug?] EXPLAIN outputs 0 for rows and width in cost estimate for update nodes
Date: 2021-01-20 08:20:58
Message-ID: CA+hUKG++esspqBytR6A6f+J+dwvxDhd7Q-NRHWOtoZCEiXv10Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 20, 2021 at 9:12 PM tsunakawa(dot)takay(at)fujitsu(dot)com
<tsunakawa(dot)takay(at)fujitsu(dot)com> wrote:
> This behavior may possibly be considered as an intended behavior for the reason that Update/Insert/Delete nodes don't output rows without RETURNING. Is this a bug or a correct behavior?

Hi Tsunakawa-san,

This was a change made deliberately. Do you see a problem?

commit f0f13a3a08b2757997410f3a1c38bdc22973c525
Author: Thomas Munro <tmunro(at)postgresql(dot)org>
Date: Mon Oct 12 20:41:16 2020 +1300

Fix estimates for ModifyTable paths without RETURNING.

In the past, we always estimated that a ModifyTable node would emit the
same number of rows as its subpaths. Without a RETURNING clause, the
correct estimate is zero. Fix, in preparation for a proposed parallel
write patch that is sensitive to that number.

A remaining problem is that for RETURNING queries, the estimated width
is based on subpath output rather than the RETURNING tlist.

Reviewed-by: Greg Nancarrow <gregn4422(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAJcOf-cXnB5cnMKqWEp2E2z7Mvcd04iLVmV%3DqpFJr
R3AcrTS3g%40mail.gmail.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2021-01-20 08:34:44 Re: Wrong usage of RelationNeedsWAL
Previous Message tsunakawa.takay@fujitsu.com 2021-01-20 08:12:34 [bug?] EXPLAIN outputs 0 for rows and width in cost estimate for update nodes