Re: how to evaluate a function only once for a query?

From: Jeff Eckermann <jeff_eckermann(at)yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Nicolae Mihalache <mache(at)abcpages(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: how to evaluate a function only once for a query?
Date: 2002-06-20 13:45:09
Message-ID: 20020620134509.28255.qmail@web20807.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Nicolae Mihalache <mache(at)abcpages(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nicolae Mihalache 2002-06-20 13:46:47 Re: how to evaluate a function only once for a query?
Previous Message Tom Lane 2002-06-20 13:30:36 Re: Coming from Oracle - trigger question