Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h3kzY-00088a-29 for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Mar 2019 17:15:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h3kzW-0006lF-O6 for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Mar 2019 17:15:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h3kzW-0006jU-GN for pgsql-hackers@lists.postgresql.org; Tue, 12 Mar 2019 17:15:02 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h3kzU-0003Se-0O for pgsql-hackers@postgresql.org; Tue, 12 Mar 2019 17:15:02 +0000 Received: by mail-wm1-x342.google.com with SMTP id 4so3508137wmf.5 for ; Tue, 12 Mar 2019 10:14:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-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=eAgU11VAz/wz2Ga8VycU3bLH/UGEAl7zSJm4yToQE8E=; b=YilwW/YMj31GEk6mgs3EBQRH6gSUpCU6HbwObvdbloczhYGcp9rbwRxNwxo8TgZ0bk YnLzP/h0KGfPDmrhB4xQDeYPRGTX+ET8xV83yu7zM/u92BSrwCdwJwQPVk2c6BL1bKy3 ck+voeh0kw6Wp8bQouOzS0d1YOGC0AEbA2MMKZwkwrbjny0ne8U7MIJxvQmhTkbgGlEs aOMci4MSY6kWGoXPzXwenGBzzQ6Itp+zfieRfo2rFBUTfXdPVewUTSmC55LhLxwXz+EZ TbgjSS8ZdxWG/PkE9bQBNJL43yMmjs6mbf/JHDYQ07RTfpTwy38p6qRwR8NQSyttDP1g 1zdA== 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=eAgU11VAz/wz2Ga8VycU3bLH/UGEAl7zSJm4yToQE8E=; b=MdfYyyfLws5mUZUlPJopbOoCDDqqKDuQX9O4UiTPRlO5/5IooUCuEQq1njOOv1DN1h 3pQuYtnKXzevD/QXNe0nPgVb5LzhLv9Ya3L1Dmr6FwbCaZkediAXUi8FyyV8GOoWCI0d uC33iIIbBtLb7Uv8aQ+Rs14bqMSLXVsRB/I5hqVyiQFhqp2aaA5VW/cw+ZF1KCPGKTgA 3I/WUuZ839pOgL7KjjZS9Ui2c4vfBU6EwdcE9EjYkWHSuwX6krWGSytqcdbC4d+L/QoM CiI8co6P8H1tNobil+XVvu4yH+coYMqoioyT7fIpIYCU0y9xkrnVWXVS649hFgsFz9gc HpgA== X-Gm-Message-State: APjAAAWNREHMMdKajDqWc/NGcUKj/fnBEbCwXEMdniHdxfLSBaBmO2V+ +7isk2GS3t8LOVc4jEZ7rDVzhUrHwj/4iIQehwpPm4WQJqj6pBi7B9guIyXatnUGakqa22K3HjV OTM4PzaeSmji3sxYj1OKg+hYSd+JBxlHBowY6gw6y/PGFnQHEhThYWCuey1N3jthWp4ujHyRNzW Vpm309mrbTNXa+3g== X-Google-Smtp-Source: APXvYqxQ6crkVD1uG9i/Km5Kd3AIsmXrcTqmLGYMqIVgz3ED7V+C6n76y7shTf/Pe5XiOVvqdPyZ7g== X-Received: by 2002:a1c:7ec2:: with SMTP id z185mr3393765wmc.69.1552410898453; Tue, 12 Mar 2019 10:14:58 -0700 (PDT) Received: from [10.137.0.18] (static-84-42-175-93.net.upcbroadband.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id v2sm3319295wme.29.2019.03.12.10.14.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Mar 2019 10:14:57 -0700 (PDT) Subject: Re: WIP: BRIN multi-range indexes To: Nikita Glukhov , Alexander Korotkov Cc: Tom Lane , Andres Freund , Mark Dilger , Alvaro Herrera , pgsql-hackers References: <20180123200537.gfx5hxcp5k5hktpe@alvherre.pgsql> <821c4c1d-592e-8916-e323-04607b11777e@2ndquadrant.com> <104E8BB8-35FF-4AA8-9871-6AFF04E4CAF3@gmail.com> <0afde2fc-e160-004f-8fe2-c65302ac3760@2ndquadrant.com> <22674.1517874015@sss.pgh.pa.us> <3e924a4c-6ca0-cc10-aebb-5004fc002800@2ndquadrant.com> <20180302035538.gkqgtcv6kmn2cklw@alap3.anarazel.de> <18526.1519963686@sss.pgh.pa.us> <1c1c1ced-1f79-a0ee-e5cd-858ca3eb9d74@2ndquadrant.com> <49cb668f-d6f9-3493-681d-7d40b715ef64@postgrespro.ru> From: Tomas Vondra Message-ID: <90be37f9-07ea-0f90-4bc6-6bdb68f4f190@2ndquadrant.com> Date: Tue, 12 Mar 2019 18:14:53 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <49cb668f-d6f9-3493-681d-7d40b715ef64@postgrespro.ru> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi Nikita, Thanks for looking at the patch. On 3/12/19 11:33 AM, Nikita Glukhov wrote: > Hi! > > I have looked at this patch set too, but so far only at first two > infrastructure patches. > > First of all, I agree that opclass parameters patch is needed here. > OK. > > 0001. Pass all keys to BRIN consistent function at once. > > I think that changing the signature of consistent function is bad, because then > the authors of existing BRIN opclasses will need to maintain two variants of > the function for different version of PosgreSQL. Moreover, we can easily > distinguish two variants by the number of parameters. So I returned back a > call to old 3-argument variant of consistent() in bringetbitmap(). Also I > fixed brinvalidate() adding support for new 4-argument variant, and fixed > catalog entries for brin_minmax_consistent() and brin_inclusion_consistent() > which remained 3-argument. And also I removed unneeded indentation shift in > these two functions, which makes it difficult to compare changes, by extracting > subroutines minmax_consistent_key() and inclusion_consistent_key(). > Hmmm. I admit I rather dislike functions that change the signature based on the number of arguments, for some reason. But maybe it's better than changing the consistent function. Not sure. > > 0002. Move IS NOT NULL checks to bringetbitmap() > > I believe that removing duplicate code is always good. But in this case it > seems a bit inconsistent to refactor only bringetbitmap(). I think we can't > guarantee that existing opclasses work with null flags in add_value() and > union() in the expected way. > > So I refactored the work with BrinValues flags in other places in patch 0003. > I added flag BrinOpcInfp.oi_regular_nulls which enables regular processing of > NULLs before calling of support functions. Now support functions don't need to > care about bv_hasnulls at all. add_value(), for example, works now only with > non-NULL values. > That seems like unnecessary complexity to me. We can't really guarantee much about opclasses in extensions anyway. I don't know if there's some sort of precedent but IMHO it's reasonable to expect the opclasses to be updated accordingly. > Patches 0002 and 0003 should be merged, I put 0003 in a separate patch just > for ease of review. > Thanks. > > 0004. BRIN bloom indexes > 0005. BRIN multi-range minmax indexes > > I have not looked carefully at these packs yet, but fixed only catalog entries > and removed NULLs processing according to patch 0003. I also noticed that the > following functions contain a lot of duplicated code, which needs to be > extracted into common subroutine: > inclusion_get_procinfo() > bloom_get_procinfo() > minmax_multi_get_procinfo() > Yes. The reason for the duplicate code is that initially this was submitted as two separate patches, so there was no obvious need for sharing code. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services