pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Antonin Houska <ah@cybertec.at>
Cc: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Subject: Re: Comment fix and question about dshash.c
Date: Sat, 27 Oct 2018 13:51:03 +0200
Message-ID: <16250.1540641063@localhost> (raw)
In-Reply-To: <15639.1540639321@localhost>
References: <8726.1540553521@localhost>
	<CAEepm=0RMoHPRovc5ugcPmKmaNRFUeZ+3bCf8uXbJ6Fx-1jCuQ@mail.gmail.com>
	<15639.1540639321@localhost>

Antonin Houska <ah@cybertec.at> wrote:

> Thomas Munro <thomas.munro@enterprisedb.com> wrote:
> 
> > On Sat, Oct 27, 2018 at 12:30 AM Antonin Houska <ah@cybertec.at> wrote:
> > 
> > Are you saying there is a bug in this logic (which is nbuckets * 0.75
> > expressed as integer maths), or saying that 0.75 is not a good maximum
> > load factor?  I looked around at a couple of general purpose hash
> > tables and saw that some used 0.75 and some used 1.0, as a wasted
> > space-vs-collision trade-off.  If I have my maths right[1], with 0.75
> > you expect to have 75 entries in ~53 buckets, but with 1.0 you expect
> > to have 100 entries in ~64 buckets.
> 
> I don't know how exactly you apply the [1] formula (what is "n" and what is
> "N" in your case?), but my consideration was much simpler: For example, if
> BUCKETS_PER_PARTITION returns 8 (power of 2 is expected here and also more
> convenient), then MAX_COUNT_PER_PARTITION returns 8 / 2 + 8 / 4 = 6. Thus the
> hashtable gets resized if we're going to add the 7th entry to the partition,
> i.e. we the number of entries in the partition is lower than the number of
> buckets. Is that o.k.?

Well, it may be o.k. I've just checked what the fill factor means in hash
index and it's also the number of entries divided by the number of buckets.

-- 
Antonin Houska
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26, A-2700 Wiener Neustadt
Web: https://www.cybertec-postgresql.com




view thread (7+ messages)  latest in thread

Message-ID: <16250.1540641063@localhost>
Permalink:  ../16250.1540641063@localhost/
Also on:    postgresql.org/message-id/16250.1540641063@localhost

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: ah@cybertec.at, thomas.munro@enterprisedb.com
  Subject: Re: Comment fix and question about dshash.c
  In-Reply-To: <16250.1540641063@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox