Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ujFjw-00543u-UW for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Aug 2025 11:21:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ujFjv-0099k1-Ky for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Aug 2025 11:21:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ujFjv-0099jn-AV for pgsql-hackers@lists.postgresql.org; Tue, 05 Aug 2025 11:21:55 +0000 Received: from fout-a2-smtp.messagingengine.com ([103.168.172.145]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1ujFjs-000qeu-1H for pgsql-hackers@lists.postgresql.org; Tue, 05 Aug 2025 11:21:54 +0000 Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id B9305EC00A4; Tue, 5 Aug 2025 07:21:52 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Tue, 05 Aug 2025 07:21:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kurilemu.de; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to; s=fm1; t=1754392912; x= 1754479312; bh=0p3dNjlOFlHJTDWQRu5zbnL723emoYcGn3qEGL0Wls0=; b=q RpLmrd8lTf0G72b0Xj9qRiTc5Ri5VGTPPoSokNZS20bLudaJuC+wGvuanq+bBPYy xHdp6LwsqSPzNfd7E2tyRi28vqCbjwy2T9llMJ16RncrjYCKnQaG5/CjFl0243lV 2gBVHFs1glm0Ba1jdftZckaRNQ+lUaCUqNBpsQd8nYsrH9HrOOY69s9258256l2M EJ2NCJBueyQzqOKrPgmNTrciU2GzGDkF4iykFRP/F8fjdaiSd6XnxjrMkzg60veE xY1eGjyo16O3QOHBOvDkjz29g2m7vt+5WIkhR9w+ZofMlxkZz0tM1wjul9yEb80A YwVyEiWflPVwZivP5OueA== 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:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1754392912; x=1754479312; bh=0 p3dNjlOFlHJTDWQRu5zbnL723emoYcGn3qEGL0Wls0=; b=hvisP4aOsEAnQd27T kWkUuiTWQRlnA5/QpeaOPCAkVXQC6nmTyX+7Ur7B+WgIzxGbEtVKT6iLza5uhpfS kCAA1/fCUXRGcMgoOSe3Wm1ZDcUUj0CqX8NFi/qTNs8z1J4SNTL302nlpTdI5Agm NDFX4ModiB6umR79od2wZxKh559iznEsLZBTXqvqd7aa7AQAgSaUlTCr2ihNUhm+ LrcBgT/GIgIlWr9zBj8YujnSfq9JfqSqIFvFSTtf0W9MgxmeQ1BjlLpm2mSelsOO hyw4akIwXTj6MN/5V+aY47e62fj6LXHBVxzDQE4b3eJIKpkWiNWwj3bmDcHQLp5h 10x/A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduudehtdegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheplmhlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsehkuhhrihhlvghmuhdruggvqeenucggtf frrghtthgvrhhnpeetuedvheffkeevgfeuheevteevkefggedttdeufeeuheduuddthfef fffhjeefffenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgv sehkuhhrihhlvghmuhdruggvpdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpoh huthdprhgtphhtthhopegrrhhsvghnihihrdhmuhhkhhhinhdruggvvhesghhmrghilhdr tghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsth hgrhgvshhqlhdrohhrghdprhgtphhtthhopehtohhmrghssehvohhnughrrgdrmhgv X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 5 Aug 2025 07:21:52 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurilemu.de; s=schmee; t=1754392911; bh=2u/ILZYEDcC7OBAiydzGG1bq7PpCbnVyNVlYBlYGnkk=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=i19jP5p8vAGpA8NM4k3Z2f6iRILAiVovdgf9jZTwCr4+2sdXfrJOKr92pl5+BuY+5 yqHbDfq4ZfSTp1pKVbk5zYkk+15kwp7iG9BuMeis+XuS6VtM/OPGrz2WSY9Iy7Ef70 l6BpEXNpjxoYbLyifY2puhbI45lqoO564wVqpxHNWUCAje6MoslmwRLZiPuwfsqxQa 045zYkPm4+mmXeHdnYhEHSOe71/fDAlEIzUd7XaXp/B5Ot1+TsmrRzXp0OGZT4aCHD 91u06VHpelXgU3rhRc4NusZWj2LlnvIIi4dn52rNKd9EGL1DkVudrzEgW2sZG5ErXC EWXBuMUVLUWWA== Received: by schmee.kurilemu.internal (Postfix, from userid 1000) id 242DB90; Tue, 5 Aug 2025 13:21:51 +0200 (CEST) Date: Tue, 5 Aug 2025 13:21:51 +0200 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: Tomas Vondra Cc: Arseniy Mukhin , PostgreSQL Hackers Subject: Re: amcheck support for BRIN indexes Message-ID: <202508051121.fy6nhwsd4l26@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <67115399-4799-4c3b-bd17-d43c98099919@vondra.me> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025-Jul-08, Tomas Vondra wrote: > On 7/8/25 14:40, Arseniy Mukhin wrote: > > Thank you for the feedback! I agree with the benefits. Speaking of > > (с), it seems most of the time to be really trivial to build such a > > ScanKey, but not every opclass supports '=' operator. amcheck should > > handle these cases somehow then. I see two options here. The first is > > to not provide 'heap all indexed' check for such opclasses, which is > > sad because even one core opclass (box_inclusion_ops) doesn't support > > '=' operator, postgis brin opclasses don't support it too AFAICS. The > > second option is to let the user define which operator to use during > > the check, which, I think, makes user experience much worse in this > > case. So both options look not good from the user POV as for me, so I > > don't know. What do you think about it? > > > > And should I revert the patchset to the consistent function version then? > > Yeah, that's a good point. The various opclasses may support different > operators, and we don't know which "strategy" to fill into the scan key. > Minmax needs BTEqualStrategyNumber, inclusion RTContainsStrategyNumber, > and so on. Hmm, maybe we can make the operator argument to the function an optional argument. Then, if it's not given, use equality for the cases where that works; if equality doesn't work for the column in that opclass, throw an error to request an operator. That way we support the most common case in the easy way, and for the other cases the user has to work a little harder -- but I think it's not too bad. I think you should have tests with indexes on more than one column. This syntax looks terrible SELECT brin_index_check('brintest_idx'::REGCLASS, true, true, '{"@>"}'); the thingy at the end looks like '90s modem line noise. Can we maybe use a variadic argument, so that if you have multiple indexed columns you specify the operators in separate args somehow and avoid the quoting and array decoration? I imagine something like SELECT brin_index_check('brintest_idx'::REGCLASS, true, true, '@>', '='); or whatever. (To think about: if I want '=' to be omitted, but I have the second column using a type that doesn't support the '=', what's a good syntax to use?) Regarding 0003: I think the new function should be just CheckIndexCheckXMin(Relation idxrel, Snapshot snap) and make the caller responsible for the snapshot handling. Otherwise you end up in the weird situation in 0004 where you have to do UnregisterSnapshot(RegisterSnapshotAndDoStuff()) instead of the more ordinary RegisterSnapshot() CheckIndexCheckXMin() UnregisterSnapshot() You need an amcheck.sgml update for the new function. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/