v19-0003-Use-fasthash-for-hash_resource_elem.patch
text/x-patch
Filename: v19-0003-Use-fasthash-for-hash_resource_elem.patch
Type: text/x-patch
Part: 1
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v19-0003
Subject: Use fasthash for hash_resource_elem
| File | + | − |
|---|---|---|
| src/backend/utils/resowner/resowner.c | 3 | 8 |
From 5dad8c783bc5d0d5f573ea136b13e79aa22d0371 Mon Sep 17 00:00:00 2001 From: John Naylor <john.naylor@postgresql.org> Date: Tue, 5 Mar 2024 17:22:16 +0700 Subject: [PATCH v19 3/3] Use fasthash for hash_resource_elem --- src/backend/utils/resowner/resowner.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/backend/utils/resowner/resowner.c b/src/backend/utils/resowner/resowner.c index ab9343bc5c..ea47c6cade 100644 --- a/src/backend/utils/resowner/resowner.c +++ b/src/backend/utils/resowner/resowner.c @@ -45,7 +45,7 @@ */ #include "postgres.h" -#include "common/hashfn.h" +#include "common/hashfn_unstable.h" #include "common/int.h" #include "storage/ipc.h" #include "storage/predicate.h" @@ -220,14 +220,9 @@ hash_resource_elem(Datum value, const ResourceOwnerDesc *kind) * the hash too, otherwise those resources will collide a lot. But * because there are only a few resource kinds like that - and only a few * resource kinds to begin with - we don't need to work too hard to mix - * 'kind' into the hash. Just add it with hash_combine(), it perturbs the - * result enough for our purposes. + * 'kind' into the hash. Just use it as the seed for fasthash. */ -#if SIZEOF_DATUM == 8 - return hash_combine64(murmurhash64((uint64) value), (uint64) kind); -#else - return hash_combine(murmurhash32((uint32) value), (uint32) kind); -#endif + return fasthash32((char *) &value, sizeof(value), (uint64) kind); } /* -- 2.43.0