Re: Re: fix cost subqueryscan wrong parallel cost

Поиск
Список
Период
Сортировка
От bucoo@sohu.com
Тема Re: Re: fix cost subqueryscan wrong parallel cost
Дата
Msg-id 202204211438224657779@sohu.com
обсуждение исходный текст
Ответ на fix cost subqueryscan wrong parallel cost  ("bucoo@sohu.com" <bucoo@sohu.com>)
Ответы Re: Re: fix cost subqueryscan wrong parallel cost
Re: Re: fix cost subqueryscan wrong parallel cost
Список pgsql-hackers
> > 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.
>  
> > Maybe the codes:
> >
> > /* Mark the path with the correct row estimate */
> > if (param_info)
> > path->path.rows = param_info->ppi_rows;
> > else
> > path->path.rows = baserel->rows;
> >
> > should change to:
> >
> > /* Mark the path with the correct row estimate */
> > if (path->path.parallel_workers > 0)
> > path->path.rows = path->subpath->rows;
> > else if (param_info)
> > path->path.rows = param_info->ppi_rows;
> > else
> > path->path.rows = baserel->rows;
>  
> Suppose parallelism is not in use and that param_info is NULL. Then,
> is path->subpath->rows guaranteed to be equal to baserel->rows? If
> yes, then we don't need to a three-part if statement as you propose
> here and can just change the "else" clause to say path->path.rows =
> path->subpath->rows. If no, then your change gives the wrong answer.
I checked some regress test, Sometimes subquery scan have filter, 
so path->subpath->row guaranteed *not* to be equal to baserel->rows.
If the first patch is false, I don't known how to fix this,
looks like need someone's help.

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Paul Guo
Дата:
Сообщение: Two small issues related to table_relation_copy_for_cluster() and CTAS with no data.
Следующее
От: Etsuro Fujita
Дата:
Сообщение: Re: postgres_fdw: batch inserts vs. before row triggers