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: Reverse the search order in afterTriggerAddEvent().
Date: Thu, 23 Jan 2025 16:08:12 +0000
Message-ID: <E1tazka-0037EW-1d@gemulon.postgresql.org> (raw)

Reverse the search order in afterTriggerAddEvent().

When scanning existing AfterTriggerSharedData records in search
of a match to the event being queued, we were examining the
records from oldest to newest.  But it makes more sense to do
the opposite.  The newest record is likely to be from the current
query, while the oldest is likely to be from some previous command
in the same transaction, which will likely have different details.

There aren't expected to be very many active AfterTriggerSharedData
records at once, so that this change is unlikely to make any
spectacular difference.  Still, having added a nontrivially-expensive
bms_equal call to this loop yesterday, I feel a need to shave cycles
where possible.

Discussion: https://postgr.es/m/4166712.1737583961@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7921927bbb9d4a80ced9283b27c26eedb638f555

Modified Files
--------------
src/backend/commands/trigger.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)



Message-ID: <E1tazka-0037EW-1d@gemulon.postgresql.org>
Permalink:  ../E1tazka-0037EW-1d@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1tazka-0037EW-1d@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Reverse the search order in afterTriggerAddEvent().
  In-Reply-To: <E1tazka-0037EW-1d@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