agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Use direct hash lookup in logicalrep_partmap_invalidate_cb()
Date: Mon, 27 Jul 2026 00:53:11 +0000
Message-ID: <E1wo9ah-00000000S6D-0eC8@gemulon.postgresql.org> (raw)

Use direct hash lookup in logicalrep_partmap_invalidate_cb()

This replaces an O(N) hash_seq_search() loop by an O(1) lookup, removing
a TODO item, making the invalidation callback faster when dealing with
many relations.  This can work because LogicalRepPartMap is keyed by a
partition OID, and a relmapentry's localreloid matches with it.

An assertion is added in logicalrep_partition_open() to enforce the fact
that localreloid matches with the hash key.

Author: DaeMyung Kang <charsyam@gmail.com>
Discussion: https://postgr.es/m/20260417174450.4158878-1-charsyam@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0962f9e344390c69e44bc55675510b2fa2b3f778

Modified Files
--------------
src/backend/replication/logical/relation.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)



Message-ID: <E1wo9ah-00000000S6D-0eC8@gemulon.postgresql.org>
Permalink:  ../E1wo9ah-00000000S6D-0eC8@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wo9ah-00000000S6D-0eC8@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: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Use direct hash lookup in logicalrep_partmap_invalidate_cb()
  In-Reply-To: <E1wo9ah-00000000S6D-0eC8@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox