pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander Korotkov <akorotkov@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Optimize InvalidateAttoptCacheCallback() and TypeCacheTypCallbac
Date: Wed, 07 Aug 2024 04:08:11 +0000
Message-ID: <E1sbXy7-00340M-1R@gemulon.postgresql.org> (raw)

Optimize InvalidateAttoptCacheCallback() and TypeCacheTypCallback()

These callbacks are receiving hash values as arguments, which doesn't allow
direct lookups for AttoptCacheHash and TypeCacheHash.  This is why subject
callbacks currently use full iteration over corresponding hashes.

This commit avoids full hash iteration in InvalidateAttoptCacheCallback(),
and TypeCacheTypCallback().  At first, we switch AttoptCacheHash and
TypeCacheHash to use same hash function as syscache.  As second, we
use hash_seq_init_with_hash_value() to iterate only hash entries with matching
hash value.

Discussion: https://postgr.es/m/5812a6e5-68ae-4d84-9d85-b443176966a1%40sigaev.ru
Author: Teodor Sigaev
Reviewed-by: Aleksander Alekseev, Tom Lane, Michael Paquier, Roman Zharkov
Reviewed-by: Andrei Lepikhov

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/40064a8ee1b34d8a128d6007416acd89077a2c11

Modified Files
--------------
src/backend/utils/cache/attoptcache.c | 39 +++++++++++++++++++++----
src/backend/utils/cache/typcache.c    | 55 +++++++++++++++++++++++++----------
2 files changed, 73 insertions(+), 21 deletions(-)



Message-ID: <E1sbXy7-00340M-1R@gemulon.postgresql.org>
Permalink:  ../E1sbXy7-00340M-1R@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1sbXy7-00340M-1R@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: akorotkov@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Optimize InvalidateAttoptCacheCallback() and TypeCacheTypCallbac
  In-Reply-To: <E1sbXy7-00340M-1R@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