Re: Set search_path + server-prepared statements = cached plan must not change result type

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Set search_path + server-prepared statements = cached plan must not change result type
Дата
Msg-id CAKFQuwaoD3nBHBFFaE9+9sJUxjT7R8gBAaDbxowVcwoQPwu-2A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Set search_path + server-prepared statements = cached plan must not change result type  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
Ответы Re: Set search_path + server-prepared statements = cached plan must not change result type
Re: Set search_path + server-prepared statements = cached plan must not change result type
Список pgsql-hackers
On Monday, January 25, 2016, Vladimir Sitnikov <sitnikov.vladimir@gmail.com> wrote:
I want to treat 'prepare' operation as an optimization step, so it is functionally equivalent to sending a query text.

In other words, I would like backend to track search_path and other parameters if necessary transparently‎, creating (caching) different execution plans if different plans are required.

Does that make sense?‎


Prepare creates a plan and a plan has a known output structure.  What you want is an ability to give a name to a parsed but unplanned query.  This is not something that prepare should do as it is not a natural extension of its present responsibility.

Maybe call the new command "PARSE name AS query".

Subsequent prepare commands could refer to named parsed commands to generate an execution plan in the current context.  If the current context matches a previously existing plan the command would effectively become a no-op.  Otherwise a new plan would be generated.  Or, more simply, using execute and a named parsed query would implicitly perform prepare per the description above.

I'm not sure how different this is from writing views...though it can be used for stuff like updates and deletes as well.  You can, I think, already get something similar by using set from current with a function...

David J.


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Minor code improvements to create_foreignscan_plan/ExecInitForeignScan
Следующее
От: "Igal @ Lucee.org"
Дата:
Сообщение: Re: Implementing a new Scripting Language