Re: ResourceOwner refactoring
Heikki Linnakangas <hlinnaka@iki.fi>
From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>,
Kyotaro Horiguchi <horikyota.ntt@gmail.com>,
Andres Freund <andres@anarazel.de>
Date: 2020-11-18T08:50:08Z
Lists: pgsql-hackers
On 18/11/2020 10:06, Michael Paquier wrote: > On Tue, Nov 17, 2020 at 04:21:29PM +0200, Heikki Linnakangas wrote: >> Attached patch refactors the ResourceOwner internals to do that. > > + * Size of the small fixed-size array to hold most-recently remembered resources. > */ > -#define RESARRAY_INIT_SIZE 16 > +#define RESOWNER_ARRAY_SIZE 8 > Why did you choose this size for the initial array? Just a guess. The old init size was 16 Datums. The entries in the new array are twice as large, Datum+pointer. The "RESOWNER_STATS" #ifdef blocks can be enabled to check how many lookups fit in the array. With pgbench, RESOWNER_ARRAY_SIZE 8: RESOWNER STATS: lookups: array 235, hash 32 If RESOWNER_ARRAY_STATS is increased to 16, all the lookups fit in the array. But I haven't done any benchmarking to see which is faster. BTW, I think there would be an easy win in the hashing codepath, by changing to a cheaper hash function. Currently, with or without this patch, we use hash_any(). Changing that to murmurhash32() or something similar would be a drop-in replacement. - Heikki
Commits
-
Make RelationFlushRelation() work without ResourceOwner during abort
- e6cd85772647 17.0 landed
-
Fix bug in bulk extending temp relation after failure
- d212957254de 17.0 landed
-
Add missing PGDLLIMPORT markings
- c6b86eaa55ff 17.0 landed
-
Add test_dsa module.
- 325f54033e59 17.0 landed
-
Clear CurrentResourceOwner earlier in CommitTransaction.
- c21e6e2fd48c 17.0 landed
-
Fix dsa.c with different resource owners.
- a8b330ffb6f7 17.0 landed
-
Fix bug in the new ResourceOwner implementation.
- 8f4a1ab471e6 17.0 landed
-
Change pgcrypto to use the new ResourceOwner mechanism.
- cd694f60dc97 17.0 landed
-
Use a faster hash function in resource owners.
- 954e43564d99 17.0 landed
-
Make ResourceOwners more easily extensible.
- b8bff07daa85 17.0 landed
-
Move a few ResourceOwnerEnlarge() calls for safety and clarity.
- b70c2143bbbe 17.0 landed