Re: NOT EXIST for PREPARE

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: NOT EXIST for PREPARE
Дата
Msg-id 11898.1458756359@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: NOT EXIST for PREPARE  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
Список pgsql-hackers
Vladimir Sitnikov <sitnikov.vladimir@gmail.com> writes:
> 2016-03-23 16:21 GMT+03:00 Merlin Moncure <mmoncure@gmail.com>:
>> On Wed, Mar 23, 2016 at 7:27 AM, Craig Ringer <craig@2ndquadrant.com> wrote:
> Craig>> With PREPARE IF NOT EXISTS the client is also paying parse and network
> Craig>> overhead for every time you send that statement. Much better
> Craig>> not to send it repeatedly in the first place.

> Merlin> How did you determine that?  The client prepares the statement exactly
> Merlin> once.  The problem is there's no easy way to determine if someone else
> Merlin> prepared it first and this patch directly addresses that.

> With suggested "prepare if not exists", client would still have to send full
> query text along with "prepare if not exist" command.
> That is "network overhead".

Yes.  Also, the query would certainly go through the lex and raw-parse
steps (scan.l and gram.y) on the database side before we could get as far
as realizing that it's a PREPARE IF NOT EXISTS and we should check for
pre-existence of the statement name.  Those steps are a nontrivial
fraction of the full parse-analysis overhead, especially for simpler
statements.

So I wouldn't take it as a given that this is actually going to be
very efficient.  Some measurements would be important to make the case
that this is worth having.
        regards, tom lane



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

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: NOT EXIST for PREPARE
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Rationalizing code-sharing among src/bin/ directories