Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1whqZw-000S9H-2w for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Jul 2026 15:22:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1whqZu-00DX4q-1c for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Jul 2026 15:22:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1whqZu-00DX4h-0j for pgsql-hackers@lists.postgresql.org; Thu, 09 Jul 2026 15:22:18 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1whqZr-00000000Umi-2bZq for pgsql-hackers@postgresql.org; Thu, 09 Jul 2026 15:22:18 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 669FMCpW2461735; Thu, 9 Jul 2026 11:22:13 -0400 From: Tom Lane To: Robert Haas cc: Andrew Dunstan , "pgsql-hackers@postgresql.org" Subject: Re: json/jsonb cleanup + FmgrInfo caching In-reply-to: References: Comments: In-reply-to Robert Haas message dated "Thu, 09 Jul 2026 11:15:46 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2461733.1783610532.1@sss.pgh.pa.us> Date: Thu, 09 Jul 2026 11:22:12 -0400 Message-ID: <2461734.1783610532@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Robert Haas 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