Re: Interesting case of IMMUTABLE significantly hurting performance

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: Olleg Samoylov <splarv(at)ya(dot)ru>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Interesting case of IMMUTABLE significantly hurting performance
Date: 2025-04-09 21:06:12
Message-ID: CAKFQuwY51Us6LeBxtdL7MbHpJkxYpWtMOHJAhUoXXN2p5f1JfQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Apr 9, 2025 at 1:50 PM Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
wrote:

> If you use EXPLAIN (VERBOSE), you will see that the function gets inlined
> in the fast case.
>
> That saves the overhead of a function call.
>
> The IMMUTABLE function cannot be inlined because to_char() is not
> IMMUTABLE.
>

So, the punishment for lying about the volatility of one's function is to
prohibit it from being inlined even in a case where had you been truthful
about the volatility it would have been inlined.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nico Williams 2025-04-09 21:21:40 Re: Interesting case of IMMUTABLE significantly hurting performance
Previous Message Adrian Klaver 2025-04-09 20:59:40 Re: [EXTERNAL] Re: Cannot connect local with ttrust (pg_upgrade assumes it)