pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove small inefficiency in ExecARDeleteTriggers/ExecARUpdateTr
Date: Wed, 31 Mar 2021 00:01:50 +0000
Message-ID: <E1lROIw-0004Z1-Qa@gemulon.postgresql.org> (raw)

Remove small inefficiency in ExecARDeleteTriggers/ExecARUpdateTriggers.

Whilst poking at nodeModifyTable.c, I chanced to notice that while
its calls to ExecBR*Triggers and ExecIR*Triggers are protected by
tests to see if there are any relevant triggers to fire, its calls
to ExecAR*Triggers are not; the latter functions do the equivalent
tests themselves.  This seems possibly reasonable given the more
complex conditions involved, but what's less reasonable is that
the ExecAR* functions aren't careful to do no work when there is
no work to be done.  ExecARInsertTriggers gets this right, but the
other two will both force creation of a slot that the query may
have no use for.  ExecARUpdateTriggers additionally performed a
usually-useless ExecClearTuple() on that slot.  This is probably
all pretty microscopic in real workloads, but a cycle shaved is a
cycle earned.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/65158f497a7d7523ad438b2034d01a560fafe6bd

Modified Files
--------------
src/backend/commands/trigger.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)



Message-ID: <E1lROIw-0004Z1-Qa@gemulon.postgresql.org>
Permalink:  ../E1lROIw-0004Z1-Qa@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lROIw-0004Z1-Qa@gemulon.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Remove small inefficiency in ExecARDeleteTriggers/ExecARUpdateTr
  In-Reply-To: <E1lROIw-0004Z1-Qa@gemulon.postgresql.org>
  References: <E1lROIw-0004Z1-Qa@gemulon.postgresql.org>

* 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