Re: fix cost subqueryscan wrong parallel cost - Mailing list pgsql-hackers

From Tom Lane
Subject Re: fix cost subqueryscan wrong parallel cost
Date
Msg-id 2455611.1651690118@sss.pgh.pa.us
Whole thread Raw
In response to Re: fix cost subqueryscan wrong parallel cost  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Tue, May 3, 2022 at 2:13 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> In any case, fundamental redesign of what EXPLAIN prints is a job
>> for v16 or later.  Are you okay with the proposed patch as a v15 fix?

> Yes. I can't really vouch for it, but I don't object to it.

I re-read the patch and noticed that I'd missed one additional change
needed:

-    run_cost = cpu_per_tuple * baserel->tuples;
+    run_cost = cpu_per_tuple * path->subpath->rows;

That is, we should estimate the number of qual evaluations and
cpu_tuple_cost charges based on the subpath row count not the
non-parallel-aware relation size.  So this reduces the cost of
the SubqueryScan itself, as well as its row count, in partial paths.
I don't see any further change in regression test results though.

Pushed with that change.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: strange slow query - lost lot of time somewhere
Next
From: Jeff Janes
Date:
Subject: Re: Query generates infinite loop