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 1uZOlv-002snt-Dc for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Jul 2025 06:59: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 1uZOlt-00Dvlw-58 for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Jul 2025 06:59:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uZOls-00Dvlo-RA for pgsql-hackers@lists.postgresql.org; Wed, 09 Jul 2025 06:59:13 +0000 Received: from mail-yb1-xb31.google.com ([2607:f8b0:4864:20::b31]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uZOlr-006bBw-17 for pgsql-hackers@lists.postgresql.org; Wed, 09 Jul 2025 06:59:13 +0000 Received: by mail-yb1-xb31.google.com with SMTP id 3f1490d57ef6-e8276224c65so4456504276.0 for ; Tue, 08 Jul 2025 23:59:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752044349; x=1752649149; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=cJFomBJtT/YdVadL+jNJ5p5ZCMaW41s6pUdGvKtRV90=; b=Pm9vcMY/Dl54PWnD3jh/Ij739H2mEWaUlOtH8JxxfSkEQoxQkx7TL17/X7WiWSbnsr TL9jfTQ3bXg6+FMMYWO4Rt5iMooRhHKHoXfBsYJ8782UP4bKy/vEO6TodHFFeUOGLPna gji8q+KIArY6L9vNLo0yEf/RgoznqhHlVK8/eBy+BhDvYVZMUD4yneyOWn8UqXYxyGHh g8UeLPUMmXdPfbQCyV0QRQ8ajF1vs1/A16Iq69a90BE4k7m3lz1atHqGHJF8Tdkrtgqf Vvd9nBHz7Dz4Rq1gsMSUshML/Wy96M6dIMZSkwuQqGV9wgCHwwwmx1FoctQFxJdO+lAb /FnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752044349; x=1752649149; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cJFomBJtT/YdVadL+jNJ5p5ZCMaW41s6pUdGvKtRV90=; b=aMl/jD1c0P5YNHRDk1rfwDtpP7ucsjf6EtG0RzGQrsB/jzeogDTsrUI+IThIU7W84L zXdbru2U8yFyQnT7Ow3dBxWa37RLGtBlJcFcb42EQIpxbC+4+xN7dv4FdOfbGSbN+LWZ +j6y5QS5AUxE3/gHJEFMPYQmf2Wvs39O1CcvP/TKupij1WC6+MAtNwTW5c/6670uAbi1 k6gtXSW4OmnTLTB5L7dlY9N+89XO8Z8IMySGtEvNLfM9ryUfyLQa/bqgm2zhMoFYnmSm J1cIykrOcQHHL69aSKwWeFnwXayW/X4TcMg9CUk0VXVYJjViONbCJm9gZyCo3N7xyQWS ADLw== X-Forwarded-Encrypted: i=1; AJvYcCUAkundRlpOzVT/fkQLsYaO4ggEXCsaqI0sGr1RjhQgjsb1B3hA2Qy76QCjMAOVETkjXrClphmYBh1b/X+r@lists.postgresql.org X-Gm-Message-State: AOJu0YyQ8FfPmsBTJiPVoT4DL89bOHF2dT03aOgp6+fEMsf71Dh1XhJ6 voZfFsNO+/uF+J5JUqqNbieFFLX+8ZUXgl+dnJJ9cmRCu/f+PoN4ft9E8+eSYUw9SJorfwfvcms PJHQaL3uofxhFBWABEWYjDyvf8R/XBFA= X-Gm-Gg: ASbGncsyZSqkFChmiTkkkj/yzhDesdo8NJQrTD+9rZCTbACnheg1P+s/rQ/mqQBSAWy 6t22a9A2Xh6Sf5jzY3be2/smXSZb/WIHCA3dkM0GRMLue9/V7hsILnQ0j/22rheTdTK1bujD60A ta+Y63k7z8mFx4ggyuCqYG/lr2zqee2D/AK0AQzcrRfWHBj7yLFt92MpM= X-Google-Smtp-Source: AGHT+IGtVq32upxp/esKGo31h5m0BcvG2+bD9KqqJfVBUfYa3qgtw6bQu23Mmejj8zZ0XzRYgGxLMk2Cph+fwp2hnio= X-Received: by 2002:a05:690c:308:b0:70e:2c7f:2ee7 with SMTP id 00721157ae682-717b1ba30f7mr22331387b3.12.1752044349097; Tue, 08 Jul 2025 23:59:09 -0700 (PDT) MIME-Version: 1.0 References: <202507071221.am6rbd6n4dct@alvherre.pgsql> <67115399-4799-4c3b-bd17-d43c98099919@vondra.me> In-Reply-To: <67115399-4799-4c3b-bd17-d43c98099919@vondra.me> From: Arseniy Mukhin Date: Wed, 9 Jul 2025 09:58:57 +0300 X-Gm-Features: Ac12FXzyn6C5fbWn_ANvehZWswBCsGais_lmxGBI4Ym9cZd4OcCzOguCASoKd7U Message-ID: Subject: Re: amcheck support for BRIN indexes To: Tomas Vondra Cc: =?UTF-8?Q?=C3=81lvaro_Herrera?= , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Jul 8, 2025 at 4:21=E2=80=AFPM Tomas Vondra wrote= : > > > > On 7/8/25 14:40, Arseniy Mukhin wrote: > > On Mon, Jul 7, 2025 at 3:21=E2=80=AFPM =C3=81lvaro Herrera wrote: > >> > >> On 2025-Jul-07, Tomas Vondra wrote: > >> > >>> Alvaro, what's your opinion on the introduction of the new WITHIN_RAN= GE? > >>> 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 > > (=D1=81), it seems most of the time to be really trivial to build such = a > > ScanKey, but not every opclass supports '=3D' 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 > > '=3D' 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 the= n? > > > > 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 ... This doesn't change much, but it seems we need an array of operators in the case of a multi-column index. And one more thing, it's theoretically possible that opclass doesn't have the operator we need at all. I'm not aware of such cases, but perhaps in the future something like GIN tsvector_ops could be created for BRIN. tsvector_ops doesn't have an operator that could be used here. Best regards, Arseniy Mukhin