From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Centralizing protective copying of utility statements
Date: Thu, 17 Jun 2021 16:36:22 -0400
Message-ID: <1057943.1623962182@sss.pgh.pa.us> (raw)
In-Reply-To: <20210617192300.7gkpqim43gk7ernd@alap3.anarazel.de>
References: <931771.1623893989@sss.pgh.pa.us>
<20210617192300.7gkpqim43gk7ernd@alap3.anarazel.de>
Andres Freund <andres@anarazel.de> writes:
> On 2021-06-16 21:39:49 -0400, Tom Lane wrote:
>> Although this adds some overhead in the form of copying of
>> utility node trees that won't actually mutate during execution,
>> I think that won't be too bad because those trees tend to be
>> small and hence cheap to copy.
> Have you evaluated the cost in some form? I don't think it a relevant
> cost for most utility statements, but there's a few exceptions that *do*
> worry me. In particular, in some workloads transaction statements are
> very frequent.
I hadn't, but since you mention it, I tried this test case:
$ cat trivial.sql
begin;
commit;
$ pgbench -n -M prepared -f trivial.sql -T 60
I got these results on HEAD:
tps = 23853.244130 (without initial connection time)
tps = 23810.759969 (without initial connection time)
tps = 23167.608493 (without initial connection time)
tps = 23784.432746 (without initial connection time)
and adding the v2 patch:
tps = 23298.081147 (without initial connection time)
tps = 23614.466755 (without initial connection time)
tps = 23475.297853 (without initial connection time)
tps = 23530.826527 (without initial connection time)
So if you squint there might be a sub-one-percent difference
there, but it's barely distinguishable from the noise. In
any situation where the transactions are doing actual work,
I doubt you could measure a difference.
(In any case, if someone does get excited about this, they
could rearrange things to push the copyObject calls into the
individual arms of the switch in ProcessUtility. Personally
though I doubt it could be worth the code bloat.)
regards, tom lane
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: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, andres@anarazel.de, pgsql-hackers@lists.postgresql.org
Subject: Re: Centralizing protective copying of utility statements
In-Reply-To: <1057943.1623962182@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox