Re: Prepared statements considered harmful

Поиск
Список
Период
Сортировка
От Lukas Kahwe Smith
Тема Re: Prepared statements considered harmful
Дата
Msg-id 44F7E0A0.3040506@pooteeweet.org
обсуждение исходный текст
Ответ на Re: Prepared statements considered harmful  (Martijn van Oosterhout <kleptog@svana.org>)
Ответы Re: Prepared statements considered harmful  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-hackers
Martijn van Oosterhout wrote:
> On Thu, Aug 31, 2006 at 07:04:07PM -0400, Gregory Stark wrote:
>> The server has to prepare the query sometime. The v3 protocol just gives you
>> control over when that happens, but it doesn't force you to do it at any
>> particular time.
> 
> Not really. All named prepares are planned straight away, all unnamed
> ones are planned at bind time. Therefore you cannot have more than one
> parsed-but-not-planned prepared query at a time. In a connection pool
> scenario there's no way to share such plans since you can't tell which
> query has been prepared. That's not forcing, but it's an asymmetry we
> could do with out.

AFAIK since Oracle 9i planning is always deferred until the first 
execution. This way they hope to get a better plan, which would 
obviously not be possible if the selectivity varies greatly.

So are the plans generated without taking any bound values into account 
more stable in performance (albeit at times slower than what would have 
been produced if the value would have been known)?

Either way mixing the question of when to prepare the plan with the 
prepared statement being named or unnamed seems unexpected.

regards,
Lukas


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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Prepared statements considered harmful
Следующее
От: "Zeugswetter Andreas DCP SD"
Дата:
Сообщение: Re: Prepared statements considered harmful