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 [EMAIL PROTECTED] Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match