Re: Function is called multiple times in subselect

From: "Alex J(dot) Avriette" <alex(at)posixnap(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Chris Campbell <chris(at)bignerdranch(dot)com>, PostgreSQL Bugs List <pgsql-bugs(at)postgresql(dot)org>, Don Marco <mark(at)bignerdranch(dot)com>, Aaron Hillegass <aaron(at)bignerdranch(dot)com>
Subject: Re: Function is called multiple times in subselect
Date: 2004-03-12 20:13:19
Message-ID: 20040312201319.GY6396@posixnap.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Mar 12, 2004 at 09:41:39AM -0500, Tom Lane wrote:

> > And if you are concerned about the query's cost vs its actual output
> > (you weren't clear in your original message), there is the 'iscachable'
> > pragma for functions.

> One of the reasons we renamed that pragma to "immutable" is that too
> many people were interpreting it as suggesting that Postgres would do
> some kind of caching of the function's results. There is no such cache.

Well, I'm glad you told me that. However, I think that it could still be
useful. This allows indices to be built upon the results of functions. In
one case this proved to be tremendously fast compared to using lower(foo)
dynamically. lower(foo) will always return the same value, as would the
original poster's.

But I digress.

Alex

--
alex(at)posixnap(dot)net
Alex J. Avriette, Unix Systems Gladiator
"Shut down some of the bullshit the government is spending money on and use it
to buy all the Microsoft stock. If we did that, we could ... just bronze Gates,
turn him into a statue, and stick him in front of the Commerce Department." - Scott McNealy

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-03-13 20:05:56 Re: small bug in ADD CONSTRAINT
Previous Message Tom Lane 2004-03-12 16:33:19 Re: Function is called multiple times in subselect