Re: [GENERAL] dynamically generated SQL and planner/performance

2008-03-22 Thread Alvaro Herrera
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. Ea

Re: [GENERAL] dynamically generated SQL and planner/performance

2008-03-22 Thread Ivan Sergio Borgonovo
On Sat, 22 Mar 2008 14:56:28 -0300 Alvaro Herrera <[EMAIL PROTECTED]> wrote: > PL/pgSQL can present a query to the planner, and get a plan. This > plan can be cached by PL/pgSQL. So if you execute a function > twice, the first time PL/pgSQL caches the plan and passes it to the > executor; the s

Re: [GENERAL] dynamically generated SQL and planner/performance

2008-03-22 Thread Alvaro Herrera
Ivan Sergio Borgonovo wrote: > On Fri, 21 Mar 2008 12:15:19 +0100 > "Albe Laurenz" <[EMAIL PROTECTED]> wrote: > > > The execution plan of dynamic queries from PL/pgSQL will not be > > cached; the query will be prepared at execution time every time you > > execute it. > > Pardon my ignorance but I

Re: [GENERAL] dynamically generated SQL and planner/performance

2008-03-21 Thread Ivan Sergio Borgonovo
On Fri, 21 Mar 2008 12:15:19 +0100 "Albe Laurenz" <[EMAIL PROTECTED]> wrote: > The execution plan of dynamic queries from PL/pgSQL will not be > cached; the query will be prepared at execution time every time you > execute it. Pardon my ignorance but I really have a very vague idea of what the pl

Re: [GENERAL] dynamically generated SQL and planner/performance

2008-03-21 Thread Albe Laurenz
Ivan Sergio Borgonovo wrote: > I've a lot of code that should call different functions according to > values in tables. > > something like: > > > create table FuncName(Name varchar(10), arg int); > > insert into FuncName values('ciro',5); > insert into FuncName values('pino',7); > insert into F

[GENERAL] dynamically generated SQL and planner/performance

2008-03-20 Thread Ivan Sergio Borgonovo
I've a lot of code that should call different functions according to values in tables. something like: create table FuncName(Name varchar(10), arg int); insert into FuncName values('ciro',5); insert into FuncName values('pino',7); insert into FuncName values('nano',11); create or replace funct