Re: Division in dynahash.c due to HASH_FFACTOR
Thomas Munro <thomas.munro@gmail.com>
From: Thomas Munro <thomas.munro@gmail.com>
To: Jakub Wartak <Jakub.Wartak@tomtom.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2020-09-10T02:54:17Z
Lists: pgsql-hackers
Attachments
- 0001-Remove-custom-fill-factor-support-from-dynahash.c.patch (text/x-patch) patch 0001
On Tue, Sep 8, 2020 at 11:17 PM Jakub Wartak <Jakub.Wartak@tomtom.com> wrote: > I agree with both, I just thought it might be interesting finding as this idiv might be (?) present in other common paths like ReadBuffer*() / PinBuffer() (some recent discussions, maybe on NUMA boxes), not just WAL recovery as it seems relatively easy to improve. I wrote a draft commit message for Jakub's proposed change (attached), and did a little bit of testing, but I haven't seen a case where it wins yet; I need to work on something else now but thought I'd share this much anyway. One observation is that the rule in init_htab had better agree with the expansion rule in hash_search_with_hash_value, otherwise you can size your hash table perfectly for n elements and then it still has to expand when you insert the nth element, which is why I changed >= to >. Does this make sense? Oh man, I don't like the mash-up of int, long, uint32, Size dynahash uses in various places and that are brought into relief by that comparison...
Commits
-
Code review for dynahash change.
- ff28809feb44 14.0 landed
-
Remove large fill factor support from dynahash.c.
- be0a6666656e 14.0 landed