Re: [BUGS] BUG #2150: PL/Python function delcared STABLE gets run repeatedly

2006-01-06 Thread Jim C. Nasby
On Fri, Jan 06, 2006 at 02:48:59PM -0500, Tom Lane wrote: > "Jim C. Nasby" <[EMAIL PROTECTED]> writes: > > Is caching of results for STABLE/IMMUTABLE functions called with a > > constant something that would be reasonable to add? > > I tend to think not: the distributed overhead would outweigh the

Re: [BUGS] BUG #2150: PL/Python function delcared STABLE gets run repeatedly

2006-01-06 Thread Tom Lane
"Jim C. Nasby" <[EMAIL PROTECTED]> writes: > Is caching of results for STABLE/IMMUTABLE functions called with a > constant something that would be reasonable to add? I tend to think not: the distributed overhead would outweigh the advantages. See previous discussions in the archives. (However, t

Re: [BUGS] BUG #2150: PL/Python function delcared STABLE gets run repeatedly

2006-01-06 Thread Jim C. Nasby
On Fri, Jan 06, 2006 at 12:43:06PM -0500, Tom Lane wrote: > Oh, you are misunderstanding the point of IMMUTABLE/STABLE. > STABLE essentially gives the planner permission to use the function > in an indexscan qualification. It does *not* cause any caching of > the function result in other contexts,

Re: [BUGS] BUG #2150: PL/Python function delcared STABLE gets run repeatedly

2006-01-06 Thread Tom Lane
Aaron Swartz <[EMAIL PROTECTED]> writes: > The function we're running returns an array, and it is non-trivial to > compute. We do a simple query with it like "SELECT * FROM > tablename WHERE id = any(foo(21))"). > When the function is STABLE (or VOLATILE) the function is run > to generate the arra

Re: [BUGS] BUG #2150: PL/Python function delcared STABLE gets run repeatedly

2006-01-06 Thread Tom Lane
"Aaron Swartz" <[EMAIL PROTECTED]> writes: > We have the PL/Python function get_foo(n) that returns an array. If this > function is declared IMMUTABLE, then: > SELECT * FROM tablenamehere WHERE id = any(get_foo(21)); > returns quickly. If the function is declared STABLE, however, PostgreSQL > seems

[BUGS] BUG #2150: PL/Python function delcared STABLE gets run repeatedly

2006-01-06 Thread Aaron Swartz
The following bug has been logged online: Bug reference: 2150 Logged by: Aaron Swartz Email address: [EMAIL PROTECTED] PostgreSQL version: 8.1.1 Operating system: Mac OS X Description:PL/Python function delcared STABLE gets run repeatedly Details: We have the PL/Pyt