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 1pXRGM-0005N4-On for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Mar 2023 18:33:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pXRGL-0000Wo-Gq for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Mar 2023 18:33:13 +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 1pXRGL-0000Wd-7Q for pgsql-hackers@lists.postgresql.org; Wed, 01 Mar 2023 18:33:13 +0000 Received: from new4-smtp.messagingengine.com ([66.111.4.230]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pXRGD-0007x5-FC for pgsql-hackers@lists.postgresql.org; Wed, 01 Mar 2023 18:33:12 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id E1A76581FC0; Wed, 1 Mar 2023 13:33:04 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Wed, 01 Mar 2023 13:33:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :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=fm1; t=1677695584; x=1677702784; bh=x ibQWu5bRZyiCrDqKTegwSyFx0xOqcSmryoSxzuDVP8=; b=J+C+0F9f6QwNJHuid XEJBMwzdVZXpzuD52r8YKFn6BUf8pP51l2Qvlr37MenpA0Wn4mLtCVthd+z0RpEM RODuBSqiq86n+XXTf7a38R3FlI68Y4g33CpLnRGc9LTYQjrI1NjD9Q59yke66Z+H Ivv3DHiZ0/ptv+NkTEQ0uSKURTkh8I5c8UQsweYWi6+uPu+BsnS+PIQd6sEF9/SP Q9kWFcT1LdIEW9Ep3JuVGwUdGig3sjvKag3ynRMb1D5/CGfb0xkWCLUHkqweb6va m7JPePhCVnz3ZDQsyOLE6cIvOlOEvFIDjLKX/b7nsZFrU+YJr6v+hrZWSzLJ2xW1 92yzw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudelhedguddtiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhv rghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorh hgqeenucggtffrrghtthgvrhhnpedvkedtffduffdtffffheffhfejjefhgfeiueeukeej keffgfdufffhudffffeuveenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtoh hmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghl vhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 1 Mar 2023 13:33:03 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 0668867; Wed, 1 Mar 2023 19:33:01 +0100 (CET) Date: Wed, 1 Mar 2023 19:33:01 +0100 From: Alvaro Herrera To: Tomas Vondra Cc: Matthias van de Meent , Justin Pryzby , Andres Freund , Greg Stark , Zhihong Yu , PostgreSQL Hackers Subject: Re: PATCH: Using BRIN indexes for sorted output Message-ID: <20230301183301.w3m5f2fbovm5hv5c@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5598409b-4ce8-dec2-acee-272e94c4b21b@enterprisedb.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-Feb-24, Tomas Vondra wrote: > On 2/24/23 16:14, Alvaro Herrera wrote: > > I think a formulation of this kind has the benefit that it works after > > BlockNumber is enlarged to 64 bits, and doesn't have to be changed ever > > again (assuming it is correct). > > Did anyone even propose doing that? I suspect this is unlikely to be the > only place that'd might be broken by that. True about other places also needing fixes, and no I haven't see anyone; but while 32 TB does seem very far away to us now, it might be not *that* far away. So I think doing it the other way is better. > > ... if pagesPerRange is not a whole divisor of MaxBlockNumber, I think > > this will neglect the last range in the table. > > Why would it? Let's say BlockNumber is uint8, i.e. 255 max. And there > are 10 pages per range. That's 25 "full" ranges, and the last range > being just 5 pages. So we get into > > prevHeapBlk = 240 > heapBlk = 250 > > and we read the last 5 pages. And then we update > > prevHeapBlk = 250 > heapBlk = (250 + 10) % 255 = 5 > > and we don't do that loop. Or did I get this wrong, somehow? I stand corrected. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/