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 1uZ8G3-00GUic-42 for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Jul 2025 13:21:15 +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 1uZ8G1-008R0c-7i for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Jul 2025 13:21:13 +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 1uZ8G0-008R0U-To for pgsql-hackers@lists.postgresql.org; Tue, 08 Jul 2025 13:21:13 +0000 Received: from relay15.mail.gandi.net ([217.70.178.235]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1uZ8Fx-006E5I-1O for pgsql-hackers@lists.postgresql.org; Tue, 08 Jul 2025 13:21:12 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 7D8DB4421F; Tue, 8 Jul 2025 13:21:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vondra.me; s=gm1; t=1751980867; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B3lXhbc1YUKATcNDQFxrdjVFdRG5bKruH9JdbAmr4Jo=; b=hqI9Cd6dWbZr9YpMmRX5JJk5hZReAiotv9CBlvjjt+N5TpObAyy0vxe0YIeubLFYGAJplM fBipOB0+3QSr47UlmKHBKdMmKAInajkPOZ++SyXjrkO92rGmiolU9CnSfublzIsCbrrJgg /hvGK8W6wn1Fuqy5RIqkWhrRZP8gM+/J7lh+T3iKD5ylZATljZ1MuTgn9qs6iez+xlWIJN 8rc16EfXPILOLLYrKVbzJLbD0l8CABwyEATTiIU8k9NX2CVz+ZQtlavi1tJwnUdtSYiVgg qfFkxdaysCirho1TFUtNC92BoIkCBH3+6qOYvx/RaDBCGzSDT3CycXTO6O2PkQ== Message-ID: <67115399-4799-4c3b-bd17-d43c98099919@vondra.me> Date: Tue, 8 Jul 2025 15:21:04 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: amcheck support for BRIN indexes To: Arseniy Mukhin , =?UTF-8?Q?=C3=81lvaro_Herrera?= Cc: PostgreSQL Hackers References: <202507071221.am6rbd6n4dct@alvherre.pgsql> Content-Language: en-US From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdefgeejkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpefvohhmrghsucggohhnughrrgcuoehtohhmrghssehvohhnughrrgdrmhgvqeenucggtffrrghtthgvrhhnpeeuvddvieefffefkedugefgtdeigeelgfegudehffevieehgffghefgvdduteffveenucfkphepkeeirdegledrvdeftddrvddtieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeekiedrgeelrddvfedtrddvtdeipdhhvghloheplgdutddrudefjedrtddrvdgnpdhmrghilhhfrhhomhepthhomhgrshesvhhonhgurhgrrdhmvgdpnhgspghrtghpthhtohepfedprhgtphhtthhopegrrhhsvghnihihrdhmuhhkhhhinhdruggvvhesghhmrghilhdrtghomhdprhgtphhtthhopegrlhhvhhgvrhhrvgeskhhurhhilhgvmhhurdguvgdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 7/8/25 14:40, Arseniy Mukhin wrote: > On Mon, Jul 7, 2025 at 3:21 PM Álvaro Herrera wrote: >> >> On 2025-Jul-07, Tomas Vondra wrote: >> >>> Alvaro, what's your opinion on the introduction of the new WITHIN_RANGE? >>> I'd probably try to do this using the regular consistent function: >>> >>> (a) we don't need to add stuff to all BRIN opclasses to support this >>> >>> (b) it gives us additional testing of the consistent function >>> >>> (c) building a scan key for equality seems pretty trivial >>> >>> What do you think? >> >> Oh yeah, if we can build this on top of the existing primitives, then >> I'm all for that. > > 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. I wonder if there's a way to figure this out from the catalogs, but I can't think of anything. Maybe requiring the user to supply the operator (and not checking heap if it's not provided) SELECT brin_index_check(..., '@>'); would not be too bad ... Alvaro, any ideas? -- Tomas Vondra