Re: Immutable function WAY slower than Stable function?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com>
Cc: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Immutable function WAY slower than Stable function?
Date: 2018-08-06 23:11:35
Message-ID: 17961.1533597095@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com> writes:
> Hi. I was recently troubleshooting a function, and realized it had
> incorrectly been declared as Immutable, when it should have been declared
> Stable. When I changed it to Stable, the query I was running ran
> dramatically faster. Digging into this a little more, this is what I found:

EXPLAIN VERBOSE might shed a bit more light. I suspect you're falling
foul of the rather arcane rules about whether a SQL function can be
inlined. (Although it seems like only the wrapper function would be
inline-able anyway, so I'm not sure why the penalty is that high.)

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ken Tanzer 2018-08-06 23:30:22 Re: Immutable function WAY slower than Stable function?
Previous Message Ken Tanzer 2018-08-06 22:49:40 Immutable function WAY slower than Stable function?