From: Alexander Korotkov <akorotkov@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid looping over all type cache entries in TypeCacheRelCallbac
Date: Sun, 25 Aug 2024 00:56:00 +0000
Message-ID: <E1si1Y0-001Kqc-3B@gemulon.postgresql.org> (raw)
Avoid looping over all type cache entries in TypeCacheRelCallback()
Currently when a single relcache entry gets invalidated,
TypeCacheRelCallback() has to loop over all type cache entries to find
appropriate typentry to invalidate. Unfortunately, using the syscache here
is impossible, because this callback could be called outside a transaction
and this makes impossible catalog lookups. This is why present commit
introduces RelIdToTypeIdCacheHash to map relation OID to its composite type
OID.
We are keeping RelIdToTypeIdCacheHash entry while corresponding type cache
entry have something to clean. Therefore, RelIdToTypeIdCacheHash shouldn't
get bloat in the case of temporary tables flood.
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, Pavel Borisov
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/c14d4acb81348a34497b53a19dce2924cc4f6551
Modified Files
--------------
src/backend/utils/cache/typcache.c | 275 +++++++++++++++++++++++++++++++------
src/tools/pgindent/typedefs.list | 1 +
2 files changed, 232 insertions(+), 44 deletions(-)
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: Avoid looping over all type cache entries in TypeCacheRelCallbac
In-Reply-To: <E1si1Y0-001Kqc-3B@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