From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | "bucoo(at)sohu(dot)com" <bucoo(at)sohu(dot)com> |
Cc: | robertmhaas <robertmhaas(at)gmail(dot)com>, Richard Guo <guofenglinux(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Re: fix cost subqueryscan wrong parallel cost |
Date: | 2022-04-22 15:55:10 |
Message-ID: | CAKFQuwaR69Ric78fMA2MyYZLioKe5MRy4DtEnf7xwTJwpMgjhg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Apr 20, 2022 at 11:38 PM bucoo(at)sohu(dot)com <bucoo(at)sohu(dot)com> wrote:
> > > for now fuction cost_subqueryscan always using *total* rows even
> parallel
> > > path. like this:
> > >
> > > Gather (rows=30000)
> > > Workers Planned: 2
> > > -> Subquery Scan (rows=30000) -- *total* rows, should be equal
> subpath
> > > -> Parallel Seq Scan (rows=10000)
> >
> > OK, that's bad.
>
I don't understand how that plan shape is possible. Gather requires a
parallel aware subpath, so said subpath can be executed multiple times in
parallel, and subquery isn't. If there is parallelism happening within a
subquery the results are consolidated using Append or Gather first - and
the output rows of that path entry (all subpaths of Subquery have the same
->row value per set_subquery_size_estimates), become the input tuples for
Subquery, to which it then applies its selectivity multiplier and stores
the final result in baserel->rows; which the costing code then examines
when costing the RTE_SUBQUERY path entry.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Bharath Rupireddy | 2022-04-22 16:09:24 | Re: Skipping schema changes in publication |
Previous Message | Zhihong Yu | 2022-04-22 15:21:03 | Re: [PATCH] Compression dictionaries for JSONB |