Re: Immutable function WAY slower than Stable function? - Mailing list pgsql-general

From Tom Lane
Subject Re: Immutable function WAY slower than Stable function?
Date
Msg-id 17961.1533597095@sss.pgh.pa.us
Whole thread Raw
In response to Immutable function WAY slower than Stable function?  (Ken Tanzer <ken.tanzer@gmail.com>)
Responses Re: Immutable function WAY slower than Stable function?
List pgsql-general
Ken Tanzer <ken.tanzer@gmail.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


pgsql-general by date:

Previous
From: Ken Tanzer
Date:
Subject: Immutable function WAY slower than Stable function?
Next
From: Ken Tanzer
Date:
Subject: Re: Immutable function WAY slower than Stable function?