Re: how to evaluate a function only once for a query? - Mailing list pgsql-general

From Jeff Eckermann
Subject Re: how to evaluate a function only once for a query?
Date
Msg-id 20020620134509.28255.qmail@web20807.mail.yahoo.com
Whole thread Raw
In response to Re: how to evaluate a function only once for a query?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: how to evaluate a function only once for a query?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Having previously on this list displayed my ignorance
of the true nature of "iscachable", I had thought that
I had it straight.  The response below has brought
back this bad memory, and now prompts me to check
again:
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
(which step I assume is implicit in the response
below).
Right?

--- Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Nicolae Mihalache <mache@abcpages.com> writes:
> > I've created a function timevalue(text) that
> returns a timestamp as
> > result. The function works just fine.
> > However, when I do a query like:
> > "select * from mytable where
> time<timevalue('something')" I see that my
> > function is evaluated once for each row in
> mytable.
>
> See the "isCachable" attribute in CREATE FUNCTION.
>
>             regards, tom lane
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Coming from Oracle - trigger question
Next
From: Nicolae Mihalache
Date:
Subject: Re: how to evaluate a function only once for a query?