Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gGN5t-0008DJ-Jp for pgsql-hackers@arkaria.postgresql.org; Sat, 27 Oct 2018 11:49:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gGN5q-0004kY-W0 for pgsql-hackers@arkaria.postgresql.org; Sat, 27 Oct 2018 11:49:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gGN5q-0004kR-LR for pgsql-hackers@lists.postgresql.org; Sat, 27 Oct 2018 11:49:26 +0000 Received: from mx2.mailbox.org ([80.241.60.215]) by makus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gGN5m-0005M3-W5 for pgsql-hackers@postgresql.org; Sat, 27 Oct 2018 11:49:25 +0000 Received: from smtp1.mailbox.org (unknown [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 36F48A1118; Sat, 27 Oct 2018 13:49:18 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id qT87CAhRgaPC; Sat, 27 Oct 2018 13:49:16 +0200 (CEST) From: Antonin Houska cc: Thomas Munro , Pg Hackers Subject: Re: Comment fix and question about dshash.c In-reply-to: <15639.1540639321@localhost> References: <8726.1540553521@localhost> <15639.1540639321@localhost> Comments: In-reply-to Antonin Houska message dated "Sat, 27 Oct 2018 13:22:01 +0200." MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 27 Oct 2018 13:51:03 +0200 Message-ID: <16250.1540641063@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Antonin Houska wrote: > Thomas Munro wrote: >=20 > > On Sat, Oct 27, 2018 at 12:30 AM Antonin Houska wrote: > >=20 > > 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. >=20 > 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 =3D 6. Th= us the > hashtable gets resized if we're going to add the 7th entry to the partiti= on, > 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. --=20 Antonin Houska Cybertec Sch=C3=B6nig & Sch=C3=B6nig GmbH Gr=C3=B6hrm=C3=BChlgasse 26, A-2700 Wiener Neustadt Web: https://www.cybertec-postgresql.com