Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lQ1Yz-0007VJ-FU for pgsql-hackers@arkaria.postgresql.org; Sat, 27 Mar 2021 05:32:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lQ1YQ-0003eq-OI for pgsql-hackers@arkaria.postgresql.org; Sat, 27 Mar 2021 05:32:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lQ1YP-0003ei-TJ for pgsql-hackers@lists.postgresql.org; Sat, 27 Mar 2021 05:32:10 +0000 Received: from forwardcorp1p.mail.yandex.net ([2a02:6b8:0:1472:2741:0:8b6:217]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lQ1YH-0000BG-Cx for pgsql-hackers@postgresql.org; Sat, 27 Mar 2021 05:32:08 +0000 Received: from sas1-ec30c78b6c5b.qloud-c.yandex.net (sas1-ec30c78b6c5b.qloud-c.yandex.net [IPv6:2a02:6b8:c14:2704:0:640:ec30:c78b]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id AB5B92E034E; Sat, 27 Mar 2021 08:31:56 +0300 (MSK) Received: from sas1-9d43635d01d6.qloud-c.yandex.net (sas1-9d43635d01d6.qloud-c.yandex.net [2a02:6b8:c08:793:0:640:9d43:635d]) by sas1-ec30c78b6c5b.qloud-c.yandex.net (mxbackcorp/Yandex) with ESMTP id N7d8u0kFxr-Vt0etSl1; Sat, 27 Mar 2021 08:31:56 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1616823116; bh=h4isiqZq33o1L3SdheHBSujZUN2+u6Q2e5L10HvY20o=; h=To:Message-Id:References:Date:Subject:Cc:In-Reply-To:From; b=cIdLhDIrqQLrG1KWEPsDFhvfMkzHmSzN6lRB44kudH4E3Wy7Ug/ElDyyBC8wReCIP OorYcoZr4XVqrcDRCZh25XSSnioP/IkMxmJOfZo0vndNUhFo8+uCVtfuX5rN2Ar6/Q fh5c31HtLGgUE2DfRrjynAeHBYqaW3LeKm7tHHGg= Authentication-Results: sas1-ec30c78b6c5b.qloud-c.yandex.net; dkim=pass header.i=@yandex-team.ru Received: from 37.9.116.80-vpn.dhcp.yndx.net (37.9.116.80-vpn.dhcp.yndx.net [37.9.116.80]) by sas1-9d43635d01d6.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id 1RLQLPykOn-VtoieFT5; Sat, 27 Mar 2021 08:31:55 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: MultiXact\SLRU buffers configuration From: Andrey Borodin In-Reply-To: Date: Sat, 27 Mar 2021 10:31:54 +0500 Cc: Gilles Darold , Tomas Vondra , Tomas Vondra , Alexander Korotkov , Anastasia Lubennikova , Daniel Gustafsson , Kyotaro Horiguchi , pgsql-hackers Content-Transfer-Encoding: quoted-printable Message-Id: <88CB7042-6181-4EF4-8B25-61EC5E5725D4@yandex-team.ru> References: <20201028013651.de5cj2xadgmba5nf@development> <13D8FD63-559A-4737-B7FD-05288D1CEF8B@yandex-team.ru> <20201028233243.ygm6yqlynkqpzekr@development> <43F3DE92-F236-4EA5-B4D6-39BEF6BD849D@yandex-team.ru> <20201029134933.xd4mh2cofuf6tdfz@development> <65C1B4BA-D16F-4939-978B-AC8F370F5A5E@yandex-team.ru> <9b4d17df-b811-8323-16be-3cab913216d1@enterprisedb.com> <35862787-8b4d-a290-789e-6e12dc6527e8@enterprisedb.com> <13F86913-C01B-4983-AE2E-493F5A028280@yandex-team.ru> <6ba7eae2-8b0c-0690-11a5-e921e6586180@darold.net> <3F5E23A3-6250-486E-9CCA-E2A5B6A28B4F@yandex-team.ru> <636f694a-4d69-d6d9-78d1-c88714f3e2e0@darold.net> <3319917a-679e-b07d-b194-473552b72082@darold.net> <1E3DD5BF-A54E-4203-86C5-94C9EFA0E095@yandex-team.ru> <04ae150b-6442-148a-bb23-77082f6fca1d@darold.net> <3768803E-4794-409D-88D2-C3EF7CA1B7FC@yandex-team.ru> <75B95FDD-2BE0-4525-8BDD-FC67C8BCBD53@yandex-team.ru> To: Thomas Munro X-Mailer: Apple Mail (2.3608.120.23.2.4) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > 27 =D0=BC=D0=B0=D1=80=D1=82=D0=B0 2021 =D0=B3., =D0=B2 01:26, Thomas = Munro =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB(= =D0=B0): >=20 > On Sat, Mar 27, 2021 at 4:52 AM Andrey Borodin = wrote: >> Some thoughts on HashTable patch: >> 1. Can we allocate bigger hashtable to reduce probability of = collisions? >=20 > Yeah, good idea, might require some study. In a long run we always have this table filled with nslots. But the keys = will be usually consecutive numbers (current working set of = CLOG\Multis\etc). So in a happy hashing scenario collisions will only = appear for some random backward jumps. I think just size =3D nslots * 2 = will produce results which cannot be improved significantly. And this reflects original growth strategy SH_GROW(tb, tb->size * 2). >> 2. Can we use specialised hashtable for this case? I'm afraid = hash_search() does comparable number of CPU cycles as simple cycle from = 0 to 128. We could inline everything and avoid hashp->hash(keyPtr, = hashp->keysize) call. I'm not insisting on special hash though, just an = idea. >=20 > I tried really hard to not fall into this rabbit h.... [hack hack > hack], OK, here's a first attempt to use simplehash, > Andres's > steampunk macro-based robinhood template Sounds magnificent. > that we're already using for > several other things I could not find much tests to be sure that we do not break something... > , and murmurhash which is inlineable and > branch-free. I think pageno is a hash already. Why hash any further? And pages = accessed together will have smaller access time due to colocation. > I had to tweak it to support "in-place" creation and > fixed size (in other words, no allocators, for use in shared memory). We really need to have a test to know what happens when this structure = goes out of memory, as you mentioned below. What would be apropriate = place for simplehash tests? > Then I was annoyed that I had to add a "status" member to our struct, > so I tried to fix that. Indeed, sizeof(SlruMappingTableEntry) =3D=3D 9 seems strange. Will = simplehash align it well? Thanks! Best regards, Andrey Borodin.=