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 1lHEpb-0002dI-Jc for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Mar 2021 23:53:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lHEpa-00078g-Ft for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Mar 2021 23:53:34 +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 1lHEpa-00078Y-8z for pgsql-hackers@lists.postgresql.org; Tue, 02 Mar 2021 23:53:34 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lHEpT-0002io-RU for pgsql-hackers@lists.postgresql.org; Tue, 02 Mar 2021 23:53:32 +0000 Received: by mail-ej1-x62c.google.com with SMTP id bm21so19859509ejb.4 for ; Tue, 02 Mar 2021 15:53:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=C+v33og2Oo5ZAGLi0bOYF8QDFTh8bn0ukquSrrfwEbw=; b=qW/LZT5H1rUxvKLdenjQ36lZ7Q+G55jAMRv2KupnVhiMLwR94XO/jRLUIxVrdH6Wlo AfLmv240q7CSJPK5clrAGZBtLC/ZleosmwSCghVPCO+H5ipkWF4U3RQGy+UrMjdFa34p ODuZhRsVG+eNXZ2Cz0Tkg8b8R1jydfEJTlPbHS0dRSyuok0oNqlqycbnRHTYs2GGR0Yu iG6GDY/ECQfiFeHqNZKX2p+99iRXVZ+yk8NsYRE+Q+0FJatGcpUtxi40RTt/woFnrrQW VqJqxJwGz61DxiZXjXMyi3umdeZS7415JxVjMg2jmYkJPD8HOLH8Jtr881n9K4vC91SR fK0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=C+v33og2Oo5ZAGLi0bOYF8QDFTh8bn0ukquSrrfwEbw=; b=iCnroiom9IGQpBVQ3mtBn9h6BNgCqY3hdXl77zlDNSAGcqiZOxZ0CKTFaCguJFL2Kl 9PmEwrMIxwIvk0j2sQt716/Tevpm8IeL6KYdmQGySyLDsSnXW9Uv1+ioqeZOAWv6fXim VmcMcII9pug1nsOtdKeKLHe3ehuB0tU2PK3SCcNNOazJX0bIm6FaVFx2GT6yox6Sj1uj mlEatpKSeElTYgoIQHXZpF1O51lMU75wkn9Rxy/lnX3oo9Mp1WAiCDCEqu+FGqMNwCZ2 BQxxQtSj6FBQdQSQ2shRvHM/dI7tH0jHyFNG2+bcfZPVcfYwP2njywpUZApnp9VVZiXj Gz6Q== X-Gm-Message-State: AOAM531J3wJ/YdlctLhUL0xVOjPU7n4ceobYkEzwvkQe6BD6O5YZlg2u iKj/wJB4TVYPlu8OeDEefglW3c7g3lUovsGCH402FZVN48x+JYcQ9njW8ahq2Ry6ZorLhKSEmug QPbx2D/Bmef91WMXFnQYNsgJ6jwjFx+wXhWFW6nxEbwBxEaFFc9h06JgQm6fbqJL2Wx/SkzOxKU qJzQUDJ7Xmra38bsXZp1QpA2bd4aNoQc9F8eBtNd6BuqhNZQpQSQJqS0qyyDJOG3gnXeeX9eRhh 1vfsnM5QpLOApBg78kBBQdgeAFRMb2iv+Qq1nPyF3xxNwYF9lwM0Q== X-Google-Smtp-Source: ABdhPJwvgc65P0HYjQRbZlUsDRUvZzDQ8qhk089l21X4s6kMAPLrMTaUfKRnk5cJ+WQEIVIzR/wb7w== X-Received: by 2002:a17:906:1ecc:: with SMTP id m12mr23238255ejj.4.1614729205692; Tue, 02 Mar 2021 15:53:25 -0800 (PST) Received: from [10.137.0.4] (ip-86-49-253-127.net.upcbroadband.cz. [86.49.253.127]) by smtp.gmail.com with ESMTPSA id h24sm20241920edt.25.2021.03.02.15.53.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Mar 2021 15:53:24 -0800 (PST) Subject: Re: WIP: BRIN multi-range indexes To: Alvaro Herrera Cc: John Naylor , PostgreSQL Hackers References: <20210302234414.GA30716@alvherre.pgsql> From: Tomas Vondra Message-ID: <4e92be8a-446b-1bab-d43d-8bd55e62e96e@enterprisedb.com> Date: Wed, 3 Mar 2021 00:53:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <20210302234414.GA30716@alvherre.pgsql> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 3/3/21 12:44 AM, Alvaro Herrera wrote: > On 2021-Mar-03, Tomas Vondra wrote: > >> 1) The 0001 patch allows passing of all scan keys to BRIN opclasses, >> which is needed for the minmax-multi to work. But it also modifies the >> existing opclasses (minmax and inclusion) to do this - but for those >> opclasses it does not make much difference, I think. Initially this was >> done because the patch did this for all opclasses, but then we added the >> detection based on number of parameters. So I wonder if we should just >> remove this, to make the patch a bit smaller. It'll also test the other >> code path (for opclasses without the last parameter). > > I think it makes sense to just do them all in one pass. I think trying > to keep the old way working just because it's how it was working > previously does not have much benefit. I don't think we care about the > *patch* being small as much as the resulting *code* being as simple as > possible (but no simpler). > That's kinda my point - I agree the size of the patch is not the primary concern, but it makes the minmax/inclusion code a bit more complicated (because they now have to loop over the keys), with very little benefit (there might be some speedup, but IMO it's rather negligible). Alternatively we could simply remove the code supporting the old API with "consistent" functions without the additional parameter. But the idea was to seamlessly support existing opclasses / not breaking them unnecessarily (I know we don't guarantee that in major upgrades, but as they may not benefit from this, why break them?). It'd simplify the code in brin.c a little bit, but the opclasses a bit more complex. > >> 2) This needs bsearch_arg, but we only have that defined/used in >> extended_statistics_internal.h - it seems silly to include that here, as >> this has nothing to do with extended stats, so I simply added another >> prototype (which gets linked correctly). But, I suppose a better way >> would be to define our "portable" variant pg_bsearch_arg, next to >> pg_qsort etc. > > Yeah, I think it makes sense to move bsearch_arg to a place where it's > more generally accesible (src/port/bsearch_arg.c I suppose), and make > both places use that. > OK, will do. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company