Re: json/jsonb cleanup + FmgrInfo caching

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: json/jsonb cleanup + FmgrInfo caching
Date: 2026-07-09 15:22:12
Message-ID: 2461734.1783610532@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> Right. I think it is a niche case, but I also don't think this is
> really costing us anything. As far as I can tell from my benchmarking
> to date, fmgr_info() is kind of expensive, but fmgr_info_copy() is
> pretty cheap. So, we could arrange to share a single flinfo for every
> argument of the VARIADIC list, but the savings are pretty limited
> because we wouldn't save fmgr_info() calls, only fmgr_info_copy()
> calls.

The hole in that argument is that fmgr_info_copy() does

dstinfo->fn_extra = NULL;

so that if the function-to-be-called caches anything in fn_extra,
it will have to populate that cache for each argument. That could be
quite expensive. It might still not justify complicating the setup
code, but I don't think it's as clear-cut as you suggest. Perhaps
some benchmarking is in order.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Paul A Jungwirth 2026-07-09 15:22:38 Re: [PATCH] Fix null pointer dereference in PG19
Previous Message Robert Haas 2026-07-09 15:15:46 Re: json/jsonb cleanup + FmgrInfo caching