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 1pVTc1-0005Az-Dt for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Feb 2023 08:39:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pVTby-0004cU-60 for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Feb 2023 08:39:26 +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 1pVTbx-0004cK-Br for pgsql-hackers@lists.postgresql.org; Fri, 24 Feb 2023 08:39:25 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pVTbu-0008CN-Nx for pgsql-hackers@lists.postgresql.org; Fri, 24 Feb 2023 08:39:24 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 26DFC5C01D9; Fri, 24 Feb 2023 03:39:20 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 24 Feb 2023 03:39:20 -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=1677227960; x=1677314360; bh=E 1gjXMQ/JErBWYVHQl6yrZOBbrkE83UbmDP8yPY0jFQ=; b=S8DkaSFrBNTtcC394 /tA2t249hlZBVBrRlap1yAY6zCkZ8VJCpTYa8Jw8mZLmcBUs8bawmkD9y985YwdN VUOhp4D2F8Tc1fV90ULVazaMuKw5mwn10SwGaHm+V6jmQgBlSunIWvql2EvNVN2g +qLvEcVmld3vhF57vQDMRttUHUYcooW3lL2rOvk6okVCVGvvXwuW7IY1RBbiKSP+ GKLKP0ncmo9wGHf+9fm/uN9kw9eQcwHqfgjdUb3uDs772c0O/fYcIlIYtyMqcmfz RQH1GuEifWqEzvqlSGNyiRkgrEMt9qFUaWB1FSaUab4s+vtbX6M0DM3mIRbmPL/b eXPxw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudekvddguddukecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhv rghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorh hgqeenucggtffrrghtthgvrhhnpedvkedtffduffdtffffheffhfejjefhgfeiueeukeej keffgfdufffhudffffeuveenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtoh hmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghl vhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 24 Feb 2023 03:39:18 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id A606CB3; Fri, 24 Feb 2023 09:39:16 +0100 (CET) Date: Fri, 24 Feb 2023 09:39:16 +0100 From: Alvaro Herrera To: Matthias van de Meent Cc: Tomas Vondra , Justin Pryzby , Andres Freund , Greg Stark , Zhihong Yu , PostgreSQL Hackers Subject: Re: PATCH: Using BRIN indexes for sorted output Message-ID: <20230224083916.tn4ikos65f4ep2od@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-Feb-23, Matthias van de Meent wrote: > > + for (heapBlk = 0; heapBlk < nblocks; heapBlk += pagesPerRange) > > I am not familiar with the frequency of max-sized relations, but this > would go into an infinite loop for pagesPerRange values >1 for > max-sized relations due to BlockNumber wraparound. I think there > should be some additional overflow checks here. They are definitely not very common -- BlockNumber wraps around at 32 TB IIUC. But yeah, I guess it is a possibility, and perhaps we should find a way to write these loops in a more robust manner. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "World domination is proceeding according to plan" (Andrew Morton)