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 1qKK58-000IM5-Cy for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Jul 2023 14:47:42 +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 1qKK56-003IB9-Ug for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Jul 2023 14:47:40 +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 1qKK56-003IAx-Ke for pgsql-hackers@lists.postgresql.org; Fri, 14 Jul 2023 14:47:40 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qKK52-000RKP-P0 for pgsql-hackers@lists.postgresql.org; Fri, 14 Jul 2023 14:47:39 +0000 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3159da54e95so2009177f8f.3 for ; Fri, 14 Jul 2023 07:47:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1689346055; x=1691938055; h=content-transfer-encoding:in-reply-to:references:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=/Iv44nREOELNWEGzLkZw25COrhu6LbhPsn7kr3nrk8k=; b=kcsvyyji3bMu8ywvDpfy8hhgGvZW8W5i+Du3ePbPwtOpZ6xfiWhhYM+TWTuhDe/pFA 8WNh6q/DGiMMxIlYOzaDD5NYFCl0D307+8pAHbM3A9GN6VmL+ljnndbmPhIripl3kpjV wXasZ7+XXl9MXvhbNguq7bF7DQ+1W8PtMd4Y6PLDfIFZC8ldz2p23OsTzn9sF4jfBR4F 6OHXTk+4bxJVJspUnKF3x33Vi4PwUGrtshn+QYJBu56NDWB6zoziUjVyq51hOivhFn1R PmKAVNUdbdy3+Uaplu86c6+ppEzDol8ykomG+LGalQc6bpYr38AZm/CgJ9fJnfrJJGyJ rn6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689346055; x=1691938055; h=content-transfer-encoding:in-reply-to:references:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/Iv44nREOELNWEGzLkZw25COrhu6LbhPsn7kr3nrk8k=; b=cfAlMUbBnc0f7pnOYR6ZPBT/BK6x9LvP9V+yvLiFKngq2CM8F+U4XzZ1snu7vqHfNg +PfzAVobH/p4xXJppTEaRa54gNDkVLzVzALJCRR9T6mgdJt2LeM2vO4tvEVTpNHo0jC6 CPiqPVIVqQ+Ieeqvcb2dh0FaIsVH6+xNu+KHIBdMaD0bFZaXEZekQCFjjdMBjuB2SULo ItFqtESSPlON1gTIaUGhPMw2O5iS1qMefFpAq2Xf3nIhxn03o5gxmlGCx35/oMQQCRhk RAMaZoRgfPebM65QB2r0AvRqqqrNB9CUHDDJMfD9LrIpUNnOoeZy+Nqqg2emftZvVRGG gnAw== X-Gm-Message-State: ABy/qLYOPXYs/hGFfhOso+nb/40CC1TCoPpJnVGf+u0jBC4auWn48XeZ liN7IgWZ+ydjjCnsye85pEloHA== X-Google-Smtp-Source: APBJJlFXziFyiuCowhZtHzQ68W0mq/kx18F3h+lPxx+X7+as5oJQ4aOAX6R2pORODuw3gPWDwXjE5g== X-Received: by 2002:a5d:6085:0:b0:314:4c1d:1c0a with SMTP id w5-20020a5d6085000000b003144c1d1c0amr4059096wrt.46.1689346054983; Fri, 14 Jul 2023 07:47:34 -0700 (PDT) Received: from [10.137.0.17] (static-84-42-175-93.bb.vodafone.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id m15-20020adfdc4f000000b003142ea7a661sm11089960wrj.21.2023.07.14.07.47.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Jul 2023 07:47:34 -0700 (PDT) Message-ID: Date: Fri, 14 Jul 2023 16:47:33 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: BRIN indexes vs. SK_SEARCHARRAY (and preprocessing scan keys) Content-Language: en-US From: Tomas Vondra To: Heikki Linnakangas , PostgreSQL Hackers References: <0e1f3350-c9cf-ab62-43a5-5dae314de89c@enterprisedb.com> <57020b2e-d9c9-9bc7-4892-b36d9bb07563@enterprisedb.com> <327064f1-276e-cb45-88c2-1ff498037cf5@enterprisedb.com> <4fa33caf-b5d1-6887-65a9-82ce9d92765c@enterprisedb.com> <1701e986-fa32-f3fa-0ac8-39fae8e5db35@enterprisedb.com> <856edf2c-8e95-0a8f-5a37-c8564a770a82@enterprisedb.com> <2484032b-3e6d-ae6a-61e5-732e2136ad18@iki.fi> <677c95ad-513f-6702-3c59-0afa2790a149@enterprisedb.com> <6a220195-52f8-303c-d154-3f29ac2f078d@iki.fi> <4c512f2b-1f08-aa43-4087-78434f94ffeb@enterprisedb.com> In-Reply-To: <4c512f2b-1f08-aa43-4087-78434f94ffeb@enterprisedb.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 7/9/23 23:44, Tomas Vondra wrote: > ... >>> Yes, my previous message was mostly about backwards compatibility, and >>> this may seem a bit like an argument against it. But that message was >>> more a question "If we do this, is it actually backwards compatible the >>> way we want/need?") >>> >>> Anyway, I think the BrinDesc scratch space is a neat idea, I'll try >>> doing it that way and report back in a couple days. >> >> Cool. In 0005-Support-SK_SEARCHARRAY-in-BRIN-bloom-20230702.patch, you >> used the preprocess function to pre-calculate the scankey's hash, even >> for scalars. You could use the scratch space in BrinDesc for that, >> before doing anything with SEARCHARRAYs. >> > > Yeah, that's a good idea. > I started looking at this (the scratch space in BrinDesc), and it's not as straightforward. The trouble is BrinDesc is "per attribute" but the scratch space is "per scankey" (because we'd like to sort values from the scankey array). With the "new" consistent functions (that get all scan keys at once) this probably is not an issue, because we know which scan key we're processing and so we can map it to the scratch space. But with the old consistent function that's not the case. Maybe we should support this only with the "new" consistent function variant? This would however conflict with the idea to have a separate consistent function for arrays, which "splits" the scankeys into multiple groups again. There could be multiple SAOP scan keys, and then what? I wonder if the scratch space should be in the ScanKey instead? regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company