Re: optimizing immutable vs. stable function calls?

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Karl Czajkowski <karlcz(at)isi(dot)edu>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: optimizing immutable vs. stable function calls?
Date: 2017-01-24 00:08:52
Message-ID: CAHyXU0wpJ-00vcHzSCJ8c+gKnDdyGKJnbpBiFeCR3b1S3uCcGQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Mon, Jan 23, 2017 at 9:10 AM, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com> wrote:
> On 1/18/17 6:09 PM, David G. Johnston wrote:
>>
>> That would not be a productive exercise for me, or most people who just
>> want
>> some idea of what to expect in terms of behavior when they write and use a
>> Stable function (Immutable and Volatile seem fairly easy to reason about).
>
>
> Yeah, this isn't an uncommon question for users to have, and "read the code"
> isn't a great answer.
>
> If there's a README or comment block that describes this, that might be a
> reasonable compromise.
>
> It would certainly be useful to document how to push the planner in the
> right direction as well. I didn't realize that SELECT ... (SELECT
> slow_stable_function()) was a thing until reading this thread.

Totally agree.

There are other odd cases as well, mostly relating to SQL inlining
(for example, marking a function IMMUTABLE can cause it to fall out of
inlining you would get by giving no designation). If you documented
all the rules, I think you'd find the rules are a bit odd and could be
simplified.

merlin

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Jeff Janes 2017-01-24 15:55:41 Re: Backup taking long time !!!
Previous Message julyanto SUTANDANG 2017-01-24 00:08:21 Re: Backup taking long time !!!