Re: IMMUTABLE?

From: David Wheeler <david(at)kineticode(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: IMMUTABLE?
Date: 2006-05-16 04:22:03
Message-ID: 3F0CF576-8C6F-433C-9942-BB36F4E1A194@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On May 15, 2006, at 20:21, Tom Lane wrote:

>> So, what gives? Am I missing something, or not understanding how
>> IMMUTABLE works?
>
> The latter.

Hee-hee! And after all those nice things I wrote about you in a
previous email on this list!

But seriously, the documentation says (as if I need to tell you, but
I was reading it again to make sure that I'm not insane):

> IMMUTABLE indicates that the function always returns the same
> result when given the same argument values; that is, it does not do
> database lookups or otherwise use information not directly present
> in its argument list. If this option is given, any call of the
> function with all-constant arguments can be immediately replaced
> with the function value.

So that seems pretty clear to me. Now, granted, the recursive calls
to fib() don't pass a constant argument, but I still would think that
after the first time I called fib(28), that the next call to fib(28)
would be lightening fast, even if fib(27) wasn't.

So, uh, would you mind telling me what I'm missing? I'm happy to turn
that knowledge into a documentation patch to help future boneheads
like myself. :-)

Thanks,

David

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2006-05-16 04:31:41 Re: IMMUTABLE?
Previous Message Tom Lane 2006-05-16 03:21:51 Re: IMMUTABLE?