Re: Static functions

From: "Gurjeet Singh" <singh(dot)gurjeet(at)gmail(dot)com>
To: "Gregory Stark" <stark(at)enterprisedb(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Joseph S" <jks(at)selectacast(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: Static functions
Date: 2008-10-04 14:14:30
Message-ID: 65937bea0810040714s30780c40g130fb1bfd038846a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Oct 4, 2008 at 6:06 PM, Gregory Stark <stark(at)enterprisedb(dot)com>wrote:

> "Gurjeet Singh" <singh(dot)gurjeet(at)gmail(dot)com> writes:
>
> > On Sat, Oct 4, 2008 at 8:49 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >
> >> "Gurjeet Singh" <singh(dot)gurjeet(at)gmail(dot)com> writes:
> >> > Shouldn't PG make all efforts to not execute something when the result
> is
> >> > already known?
> >>
> >> Not if said effort would cost more than is saved, which would be by far
> >> the most likely result if we tried to cache all function results.
> >>
> >
> > Sorry Tom, I confused STABLE with IMMUTABLE; my bad.
>
> No, this is equally untrue for immutable.

Yup... I realized that after a bit of more testing after the mail...
Immutable functions are single-call-per-command only of you are passing
constants-only as parameters; if we have an expression involving columns,
then they will be called for every row.

Best regards,
--
gurjeet[(dot)singh](at)EnterpriseDB(dot)com
singh(dot)gurjeet(at){ gmail | hotmail | indiatimes | yahoo }.com

EnterpriseDB http://www.enterprisedb.com

Mail sent from my BlackLaptop device

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dave Page 2008-10-04 15:04:33 Re: failed to install posgrest
Previous Message Gregory Stark 2008-10-04 12:36:59 Re: Static functions