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 1qGe8h-00020V-DK for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Jul 2023 11:24:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qGe8g-0003XD-6M for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Jul 2023 11:24:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qGe8f-0003Vq-3q for pgsql-hackers@lists.postgresql.org; Tue, 04 Jul 2023 11:24:09 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qGe8b-0028aR-8o for pgsql-hackers@postgresql.org; Tue, 04 Jul 2023 11:24:08 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 5873F5C0354; Tue, 4 Jul 2023 07:24:02 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 04 Jul 2023 07:24:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1688469842; x= 1688556242; bh=0Qeb7EFAcEV4IhSKryb3zeOVSfCfXSEQqqpGzFSr+co=; b=e amUMXMht3tRhwTXdnVtg3fbBvPe2h/613uohla7RfantRz9oKBWqj+Z+IJA4Y3n7 mY7e1pnOubV0R7AA7J2XtO2UIOOevs+8Ll8CojQLJiGb4JFlYJwRojgg0WhRSu/q DFziF2PHbRrIBmfxr1V36mn8trM7BIDN2z18B+TqCiS/wGEsOsVVr77XOrYHX0KO P50BtAN4u58Ht5C+9judkpyMMwZZVnSFRYIgoGDBsL1p/zEk7Wbwi6Ie08kj0Hnw XLZCGkKjn25EFB3LaKY2O76RypwbVhMVthrFayhq1JzHhaPAN6DkiHpe5YN5hnJf rE7jcfsTkkExPmTEVK0sA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudeggdeflecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpedvkedtffduffdtffffheffhfejjefhgfeiueeukeejkeff gfdufffhudffffeuveenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhh vghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 4 Jul 2023 07:24:01 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id C11679D; Tue, 4 Jul 2023 13:23:58 +0200 (CEST) Date: Tue, 4 Jul 2023 13:23:58 +0200 From: Alvaro Herrera To: Soumyadeep Chakraborty Cc: pgsql-hackers , Ashwin Agrawal , Tomas Vondra Subject: Re: brininsert optimization opportunity Message-ID: <20230704112358.bkm6r3fxp275m4lu@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-Jul-03, Soumyadeep Chakraborty wrote: > My colleague, Ashwin, pointed out to me that brininsert's per-tuple init > of the revmap access struct can have non-trivial overhead. > > Turns out he is right. We are saving 24 bytes of memory per-call for > the access struct, and a bit on buffer/locking overhead, with the > attached patch. Hmm, yeah, I remember being bit bothered by this repeated initialization. Your patch looks reasonable to me. I would set bistate->bs_rmAccess to NULL in the cleanup callback, just to be sure. Also, please add comments atop these two new functions, to explain what they are. Nice results. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/