Re: dynamically generated SQL and planner/performance

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: dynamically generated SQL and planner/performance
Дата
Msg-id 20080322204756.GE13206@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: dynamically generated SQL and planner/performance  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
Список pgsql-general
Ivan Sergio Borgonovo wrote:

> But does this cascade to all the nested functions?
>
> functionA {
>   execute functionB {
>     sql statement
>   }
> }
>
> As my previous example I've a functionA that build up a statement that
> call another functionB that just contain static sql statements.

Each function is planned and cached independently, regardless of how
they are called.  In fact the previous sentence does not really make
sense, because what truly happens is that each _sentence_ within each
function is planned and cached independently.


> If it's something like
> execute select res fron functionB() into _res;
> since the "complicated" part is inside each functionB I shouldn't
> expect any great loss.
>
> Is it?

Correct -- the part that's being discarded each time here is the SELECT
that calls up functionB, not functionB's statements themselves.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

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

Предыдущее
От: Michael Meskes
Дата:
Сообщение: Re: --enable-thread-safety bug
Следующее
От: Steve Clark
Дата:
Сообщение: Re: --enable-thread-safety bug