Re: Prepared statements and generic plans

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: Prepared statements and generic plans
Дата
Msg-id A737B7A37273E048B164557ADEF4A58B53859B69@ntex2010i.host.magwien.gv.at
обсуждение исходный текст
Ответ на Re: Prepared statements and generic plans  (Bruce Momjian <bruce@momjian.us>)
Ответы Re: Prepared statements and generic plans  ('Bruce Momjian *EXTERN*' <bruce@momjian.us>)
Список pgsql-hackers
Bruce Momjian wrote:
> OK, updated version attached.  I added "potential" to the first
> paragraph, and added "estimated cost" to the later part, fixed the
> "cheaper than", and clarified that we add the plan time cost to the
> non-generic plan, which is how it can be cheaper than the generic plan.
> I also moved the "Once a generic plan is chosen" line.
> 
> Yeah, that's a lot of changes, but they all improved the text.  Thanks.

Thanks for working on this.

!    Prepared statements can optionally use generic plans rather than
!    re-planning with each set of supplied <command>EXECUTE</command> values.
!    This occurs immediately for prepared statements with no parameters;
!    otherwise it occurs only after five or more executions produce estimated
!    plan costs, with planning overhead added, that are, on average, more
!    expensive than the generic plan cost.

The following might be easier to understand:
... after five or more executions produce plans whose estimated cost average
(including planning overhead) is more expensive than the generic plan cost estimate.

!    A generic plan assumes each value supplied to <command>EXECUTE</command>

... assumes *that* each value ...

!    is one of the column's distinct values and that column values are
!    uniformly distributed.  For example, if statistics records three

Shouldn't it be "record"?
The documentation treats "statistics" as a plural word throughout.

!    distinct column values, a generic plan assumes a column equality
!    comparison will match 33% of processed rows.  Column statistics

... assumes *that* a column equality comparison will match 33% of *the* processed rows.

!    also allows generic plans to accurately compute the selectivity of

Column statistics also *allow* ...

!    unique columns.  Comparisons on non-uniformly-distributed columns and
!    specification of non-existent values affects the average plan cost,
!    and hence if and when a generic plan is chosen.

(Disclaimer: I am not a native speaker.)
Other than that, a hearty +1.

Yours,
Laurenz Albe

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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: Relax requirement for INTO with SELECT in pl/pgsql
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: [sqlsmith] Failed assertion in joinrels.c