Re: IMMUTABLE and PARALLEL SAFE function markings

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Andres Freund <andres(at)anarazel(dot)de>, gajus(at)gajus(dot)com, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: IMMUTABLE and PARALLEL SAFE function markings
Date: 2018-11-27 04:31:52
Message-ID: CA+TgmobznkBAtvzS03Yr9f=_w9rNTAv9s4j_irmWDFtDj3woFQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Nov 26, 2018 at 11:21 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Hm. We intentionally allow SQL functions to be marked as less mutable
> than their internals, because sometimes that's useful for tricking
> the planner. However, IIRC we don't inline when we see that's the
> case. Maybe there needs to be a similar restriction for parallelism
> markings.

Not sure what you have in mind here exactly. I think that the only
correct thing to do is to mark the parent with the least safe setting
that could apply. When you inline, you might find out that things are
safer than they initially looked, but I think by then it's too late to
change your mind because ...

> Alternatively, could we postpone the parallelism checks till after
> function inlining? Do we even make any before that?

... I believe the parallel-safety checks are done very early, and if
you decide that it's not safe to proceed with parallelism, you can't
really change your mind later.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-11-27 04:38:14 Re: IMMUTABLE and PARALLEL SAFE function markings
Previous Message Andrew Gierth 2018-11-27 04:31:19 Re: IMMUTABLE and PARALLEL SAFE function markings