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