Re: Avoid excessive inlining?

From: Philip Semanchuk <philip(at)americanefficient(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: Joel Jacobson <joel(at)compiler(dot)org>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Avoid excessive inlining?
Date: 2020-12-22 14:57:19
Message-ID: B419713D-368F-433A-986F-D6027921D743@americanefficient.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On Dec 22, 2020, at 8:40 AM, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> wrote:
>
> On Mon, 2020-12-21 at 11:45 -0500, Philip Semanchuk wrote:
>>> On Dec 19, 2020, at 12:59 AM, Joel Jacobson <joel(at)compiler(dot)org> wrote:
>>> Is there a way to avoid excessive inlining when writing pure SQL functions, without having to use PL/pgSQL?
>>
>> The rules for inlining are here:
>> https://wiki.postgresql.org/wiki/Inlining_of_SQL_functions
>>
>> According to those rules, if you declared your SQL function as VOLATILE, then Postgres wouldn’t
>> inline it. From your question, I’m not sure if you want to have the same function inlined
>> sometimes and not others. I can’t think of a way to do that offhand.
>
> Where do you see that? As far as I know, VOLATILE is the best choice if you
> want the function to be inlined.

Ugh, you’re absolutely right, and I’m sorry for spreading misinformation. That’s what I get from quoting from memory rather than reading the link that I posted.

>
> I would say that the simplest way to prevent a function from being inlined
> is to set a parameter on it:
>
> ALTER FUNCTION f() SET enable_seqscan = on;

I appreciate the correction and education.

Cheers
Philip

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joel Jacobson 2020-12-22 16:10:35 Re: Avoid excessive inlining?
Previous Message Laurenz Albe 2020-12-22 13:40:20 Re: Avoid excessive inlining?