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

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Aaron Swartz <me(at)aaronsw(dot)com>, pgsql-bugs(at)postgreSQL(dot)org
Subject: Re: BUG #2150: PL/Python function delcared STABLE gets run repeatedly
Date: 2006-01-06 19:43:30
Message-ID: 20060106194330.GP3902@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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, which is what you seem to be
> wishing would happen.

Is caching of results for STABLE/IMMUTABLE functions called with a
constant something that would be reasonable to add? I certainly wish
this happened natively, but I've always hacked around it by

SELECT ... WHERE x = (SELECT foo(21))

so presumably some kind of query transform logic similar to what was
done for min/max might work.

I don't see anything about this on the TODO...
--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Berend Tober 2006-01-06 19:45:01 Re: Reordering columns in a table
Previous Message John McCawley 2006-01-06 19:41:15 Re: Reordering columns in a table