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

From Tom Lane
Subject Re: how to evaluate a function only once for a query?
Date
Msg-id 11294.1024578768@sss.pgh.pa.us
Whole thread Raw
In response to how to evaluate a function only once for a query?  (Nicolae Mihalache <mache@abcpages.com>)
Responses Re: how to evaluate a function only once for a query?  (Jeff Eckermann <jeff_eckermann@yahoo.com>)
List pgsql-general
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

pgsql-general by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: db grows and grows
Next
From: Fran Fabrizio
Date:
Subject: Re: db grows and grows