In this answer Erwin breaks down
IMMUTABLE functions into those that can be inlined, and those that can't. He has an example with
to_char() that shows an
IMMUTABLE function over
to_char() will actually be slower.
That's interesting though because I didn't even know
IMMUTABLE. Moreover, I didn't know that
IMMUTABLE would ever make anything slower. My question is now, how do I find out if a function marked as
IMMUTABLE is being inlined, or not?