Re: Division in dynahash.c due to HASH_FFACTOR

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, Jakub Wartak <Jakub(dot)Wartak(at)tomtom(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Division in dynahash.c due to HASH_FFACTOR
Date: 2020-09-19 03:55:24
Message-ID: CA+hUKGLYYkJULnB7gs7S87_+=woSpnKzqwrnf=egWR-fW0Y94A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Sep 19, 2020 at 1:30 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I wrote:
> > ISTM that getting rid of the division obviates the concern that the
> > nentries condition is too expensive,

True, that comment needed to go.

> Also, we could make it slightly cheaper yet, by changing the condition
> to
>
> hctl->freeList[0].nentries > (long) (hctl->max_bucket)
>
> ie drop the +1. I'd argue that this is actually a more faithful
> rendition of the previous condition, since what we had before was
> basically
>
> hctl->freeList[0].nentries >= (long) (hctl->max_bucket + 1)

Agreed, and done. Thanks!

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2020-09-19 04:14:58 Re: Proposal of new PostgreSQL Extension - PGSpiderExt
Previous Message Michael Paquier 2020-09-19 02:21:11 Re: pg_logging_init() can return ENOTTY with TAP tests