Re: Prepared statements and generic plans

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: Prepared statements and generic plans
Дата
Msg-id A737B7A37273E048B164557ADEF4A58B5385F25B@ntex2010i.host.magwien.gv.at
обсуждение исходный текст
Ответ на Re: Prepared statements and generic plans  ("'bruce@momjian.us'" <bruce@momjian.us>)
Ответы Re: Prepared statements and generic plans  ("'bruce@momjian.us'" <bruce@momjian.us>)
Список pgsql-hackers
Bruce Momjian wrote:
> Also, is it possible to do an EXPLAIN prepare() with the libpq/wire
> protocol?  I can't do PREPARE EXPLAIN, but I can do EXPLAIN EXECUTE.
> However, I don't see any way to inject EXPLAIN into the libpq/wire
> prepare case.  Can you specify prepare(EXPLAIN SELECT)?  (PREPARE
> EXPLAIN SELECT throws a syntax error.)

I am not sure what you mean:
EXPLAIN PREPARE to get EXPLAIN for PREPARE, or PREPARE ... FOR EXPLAIN
to get an EXPLAIN statement with parameters.
What should EXPLAIN PREPARE show that EXPLAIN SELECT wouldn't?
Why the need for EXPLAIN statements with parameters?

> Looking at how the code behaves, it seems custom plans that are _more_
> expensive (plus planning cost) than the generic plan switch to the
> generic plan after five executions, as now documented.  Custom plans
> that are significantly _cheaper_ than the generic plan _never_ use the
> generic plan.

Yes, that's what the suggested documentation improvement says as well,
right?

> Updated patch attached.

Upon re-read, one tiny question:

!    Prepared statements can optionally use generic plans rather than
!    re-planning with each set of supplied <command>EXECUTE</command> values.

Maybe the "optionally" should be omitted, since the user has no choice.

It is true that there is a cursor option CURSOR_OPT_CUSTOM_PLAN, but that
cannot be used on the SQL level.

Yours,
Laurenz Albe

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

Предыдущее
От: Ants Aasma
Дата:
Сообщение: Re: WIP: Data at rest encryption
Следующее
От: Robert Haas
Дата:
Сообщение: Re: ERROR: ORDER/GROUP BY expression not found in targetlist