Re: [PERFORM] Stored procedure declared as VOLATILE => no good optimization is done

2010-10-29 Thread Damon Snyder
Thank you for all of the responses. This was really helpful. Damon On Sat, Oct 16, 2010 at 12:54 PM, Merlin Moncure wrote: > On Fri, Oct 15, 2010 at 10:31 PM, Tom Lane wrote: > > Tatsuo Ishii writes: > >> So can I say "if a function is marked IMMUTABLE, then it should never > >> modify databa

Re: [PERFORM] Stored procedure declared as VOLATILE => no good optimization is done

2010-10-16 Thread Merlin Moncure
On Fri, Oct 15, 2010 at 10:31 PM, Tom Lane wrote: > Tatsuo Ishii writes: >> So can I say "if a function is marked IMMUTABLE, then it should never >> modify database"? Is there any counter example? >> It seems if above is correct, I can say STABLE functions should never >> modify databases as well

Re: [PERFORM] Stored procedure declared as VOLATILE => no good optimization is done

2010-10-15 Thread Tom Lane
Tatsuo Ishii writes: > So can I say "if a function is marked IMMUTABLE, then it should never > modify database"? Is there any counter example? > It seems if above is correct, I can say STABLE functions should never > modify databases as well. Both of those things are explicitly stated here: http:

Re: [PERFORM] Stored procedure declared as VOLATILE => no good optimization is done

2010-10-15 Thread Tatsuo Ishii
> broadly speaking: > *) function generates same output from inputs regardless of what's > going on in the database, and has no side effects: IMMUTABLE So can I say "if a function is marked IMMUTABLE, then it should never modify database"? Is there any counter example? > *) function reads (only)

Re: [PERFORM] Stored procedure declared as VOLATILE => no good optimization is done

2010-10-15 Thread Merlin Moncure
On Mon, Oct 11, 2010 at 7:10 PM, Damon Snyder wrote: > Hello, > I have heard it said that if a stored procedure is declared as VOLATILE, > then no good optimizations can be done on queries within the stored > procedure or queries that use the stored procedure (say as the column in a > view). I hav

Re: [PERFORM] Stored procedure declared as VOLATILE => no good optimization is done

2010-10-15 Thread Kevin Grittner
Damon Snyder wrote: > I have heard it said that if a stored procedure is declared as > VOLATILE, then no good optimizations can be done on queries within > the stored procedure or queries that use the stored procedure (say > as the column in a view). I have seen this in practice, recommended > o

[PERFORM] Stored procedure declared as VOLATILE => no good optimization is done

2010-10-15 Thread Damon Snyder
Hello, I have heard it said that if a stored procedure is declared as VOLATILE, then no good optimizations can be done on queries within the stored procedure or queries that use the stored procedure (say as the column in a view). I have seen this in practice, recommended on the irc channel, and in