Re: [COMMITTERS] pgsql: Fix cardinality estimates for parallel joins.

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Fix cardinality estimates for parallel joins.
Date: 2017-03-14 16:29:53
Message-ID: CA+TgmoYBPiXHCCf3EzFshyc1fk4NkY636PaiAWH4rL1U0x6h-w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Tue, Jan 17, 2017 at 11:49 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Mon, Jan 16, 2017 at 7:23 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>> On Sat, Jan 14, 2017 at 12:07 AM, Robert Haas <rhaas(at)postgresql(dot)org> wrote:
>>> Fix cardinality estimates for parallel joins.
>>>
>>
>> + /*
>> + * In the case of a parallel plan, the row count needs to represent
>> + * the number of tuples processed per worker.
>> + */
>> + path->rows = clamp_row_est(path->rows / parallel_divisor);
>> }
>>
>> path->startup_cost = startup_cost;
>> @@ -2014,6 +1996,10 @@ final_cost_nestloop(PlannerInfo *root, NestPath *path,
>> else
>> path->path.rows = path->path.parent->rows;
>>
>> + /* For partial paths, scale row estimate. */
>> + if (path->path.parallel_workers > 0)
>> + path->path.rows /= get_parallel_divisor(&path->path);
>>
>>
>> Isn't it better to call clamp_row_est in join costing functions as we
>> are doing in cost_seqscan()? Is there a reason to keep those
>> different?
>
> No, those should probably be changed to match.

So I guess that'd look something like this?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment Content-Type Size
clamp-parallel-join-est.patch application/octet-stream 1.6 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2017-03-14 16:48:08 pgsql: Make logging about multixact wraparound protection less chatty.
Previous Message Robert Haas 2017-03-14 16:19:29 Re: Re: [COMMITTERS] pgsql: Add test case for two phase commit. Also by Masahiko Sawada.

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-03-14 16:36:10 Re: Gather Merge
Previous Message Robert Haas 2017-03-14 16:19:29 Re: Re: [COMMITTERS] pgsql: Add test case for two phase commit. Also by Masahiko Sawada.