Re: Optimize JsonbContainerTypeName by reordering type checks

From: Andreas Karlsson <andreas(at)proxel(dot)se>
To: David Rowley <dgrowleyml(at)gmail(dot)com>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Optimize JsonbContainerTypeName by reordering type checks
Date: 2026-01-04 17:29:36
Message-ID: 64d650e6-84bb-410b-9d1e-f9cef3f1401c@proxel.se
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 1/4/26 12:21 PM, David Rowley wrote:
> I'd say this is wishful thinking. You're saying that with the overhead
> of planning, executor startup, most of executor run and executor
> shutdown and subsequent cleanup, you're expecting a speedup from
> swapping the order of operations in this function when you're calling
> it once!? That could be true if the function was very expensive, but
> this is not an expensive function. It'll amount to a few dozen
> instructions for the function out of several 10s of millions, when you
> consider the cost of processing the entire query.

On top of this the idea the scalars are a less common thing is dubious.
Why would that be? I would assume it depends on the input data. So even
if it had been a speedup, which perf output does not seem to indicate
that it would be, it would have slowed down some workloads while
speeding up others.

Andreas

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Jackson 2026-01-04 17:34:19 Proposal: Add a UNIQUE NOT ENFORCED constraint
Previous Message Tom Lane 2026-01-04 17:28:25 Re: Error position support for ComputeIndexAttrs