From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Jeff Eckermann <jeff_eckermann(at)yahoo(dot)com> |
Cc: | Nicolae Mihalache <mache(at)abcpages(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: how to evaluate a function only once for a query? |
Date: | 2002-06-20 13:58:14 |
Message-ID: | 11734.1024581494@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Jeff Eckermann <jeff_eckermann(at)yahoo(dot)com> writes:
> The only way that "iscachable" would prevent the need
> for reevaluation on every row is by permitting the
> creation of an index on the function return values
As far as I could see, he wanted the system to pre-evaluate a call
of the function with a literal-constant argument --- which is exactly
what isCachable is all about.
You're correct that in a case like
select ... where myfunc(field1) = 'constant';
the only thing that will help is an index on myfunc(field1). But this
case is quite different from
select ... where field1 = myfunc('constant');
BTW, for 7.3 the name "isCachable" will be deprecated; we now recommend
"immutable" for the same concept. Hopefully this will serve to avoid
some confusion. See the development docs for CREATE FUNCTION at
http://developer.postgresql.org/docs/postgres/sql-createfunction.html
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Varun Kacholia | 2002-06-20 14:17:09 | Re: db grows and grows |
Previous Message | Tom Lane | 2002-06-20 13:51:48 | Re: how to evaluate a function only once for a query? |