Hi hackers, I noticed that there is a magic number which can be replaced by CATCACHE_MAXKEYS in struct cachedesc, I checked some other struct like CatCache, CatCTup, they all use CATCACHE_MAXKEYS.
I did some search on pg-hackers, and found an old thread[0] that
Robert proposed to change
the maximum number of keys for a syscache from 4 to 5.
It seems to me that the *five-key syscaches* feature is not necessary
since the idea was
14 years old and we still use 4 keys without any problems(I might be wrong).
However, in that patch, there is a change that seems reasonable.
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -95,7 +95,7 @@ struct cachedesc
Oid reloid; /* OID of the
relation being cached */
Oid indoid; /* OID of
index relation for this cache */
int nkeys; /* # of keys
needed for cache lookup */
- int key[4]; /* attribute
numbers of key attrs */
+ int key[CATCACHE_MAXKEYS]; /* attribute
numbers of key attrs */
int nbuckets; /* number of
hash buckets for this cache */
};
[0]:
https://www.postgresql.org/message-id/flat/603c8f071003281532t5e6c68eex458825485d4fcd98%40mail.gmail.com
--
Regards
Junwang Zhao
v1-0001-replace-magic-num-with-CATCACHE_MAXKEYS.patch
Description: Binary data
