pgsql: Optimize InvalidateAttoptCacheCallback() and TypeCacheTypCallbac

From: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Optimize InvalidateAttoptCacheCallback() and TypeCacheTypCallbac
Date: 2024-08-07 04:08:11
Message-ID: E1sbXy7-00340M-1R@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Pavel Stehule 2024-08-07 06:34:21 Re: pgsql: Introduce hash_search_with_hash_value() function
Previous Message noreply 2024-08-06 21:16:26 pgsql: Tag refs/tags/REL_16_4 was created