public inbox for [email protected]  
help / color / mirror / Atom feed
From: Merlin Moncure <[email protected]>
To: Bernice Southey <[email protected]>
Cc: [email protected]
Subject: Re: Are SQL-language function lock ordering deadlocks solved in PostgreSQL 18?
Date: Tue, 7 Oct 2025 14:51:12 -0600
Message-ID: <CAHyXU0wGxp0oLKU+65Su5-Q04Sz3=H2DZYK843XhguwEHvEkQA@mail.gmail.com> (raw)
In-Reply-To: <CAEDh4nyqYHaG4dHT=p6yfXh3CgTfKzvVPbm19ag-3oYuCB2PMw@mail.gmail.com>
References: <CAEDh4nyqYHaG4dHT=p6yfXh3CgTfKzvVPbm19ag-3oYuCB2PMw@mail.gmail.com>

On Mon, Oct 6, 2025 at 10:54 AM Bernice Southey <[email protected]>
wrote:

> Hi pgsql-general community,
>
> I tried the simple test from the original mail [1] and indeed got
> deadlocks in version 17, but not 18. Yet absence of evidence is not
> proof of no race conditions.
>
> This might be my favourite change in 18 [2], if I'm understanding it
> right. I much prefer the install-time checking of SQL-language
> functions, and the elegance of pure SQL. But I've been convinced the
> performance benefit of plan caching gave PL/pgSQL the edge. Now I'm
> not so sure.
>

It sure seems like the intent of the change was to modify exactly that
behavior.

If you look at the major built-in sql-esque languages, sql(old), sql(new),
PSM (new standard syntax) and pl/pgsql, I guess psm style and pure SQL
might be overlapped with PSM style functions, especially if PSM functions
can be inlined (I haven't looked yet)-- inlining of functions such as
'SELECT $1 + $2' being the only reason I write sql functions these days.
 I have always found the strict compile time checking to be highly
obnoxious except in the immutable/inlinable cases that come up now and
then.

Plan caching is not so important IMO, since execution time tends to greatly
exceed plan time in my experience and the real performance bugaboo is bad,
not uncached plans.   FIxing bad plans typically involves dipping into the
pl/pgsql toolbox, using variable temp tables, planner directives, and other
forbidden tools in PSM.  In simple terms, I also used to restrict server
side coding  views and pure sql functions for abstraction, but have long
since given up, and mainly write procedures :-).

I really wish PSM functions could do what pl/pgsql functions do, since I
like the creation syntax vs the 'string is body of code',but, alas.

merlin


view thread (2+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Are SQL-language function lock ordering deadlocks solved in PostgreSQL 18?
  In-Reply-To: <CAHyXU0wGxp0oLKU+65Su5-Q04Sz3=H2DZYK843XhguwEHvEkQA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox