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 1juDcH-0005YO-3g for pgsql-hackers@arkaria.postgresql.org; Sat, 11 Jul 2020 11:24:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1juDcG-0006mH-2G for pgsql-hackers@arkaria.postgresql.org; Sat, 11 Jul 2020 11:24:24 +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 1juDcF-0006mA-I8 for pgsql-hackers@lists.postgresql.org; Sat, 11 Jul 2020 11:24:23 +0000 Received: from mail-ej1-x641.google.com ([2a00:1450:4864:20::641]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1juDcD-0002go-0z for pgsql-hackers@postgresql.org; Sat, 11 Jul 2020 11:24:22 +0000 Received: by mail-ej1-x641.google.com with SMTP id dr13so8802738ejc.3 for ; Sat, 11 Jul 2020 04:24:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=fMce2IazNc6cYnz84vzjc6+ja0FJnD7qCZDuwBTNyMI=; b=rfp/h3/VdN8qZ8k01dZyRljfza7j1rVLXwYj8fZzzHxtQCLxoAWqmGnNE88xFWIegC +V+wNjUm+4vtF9mLR7NbHOt4DEfrZ9czZwNjHmPeGq8QSq4qvYu6D2P4Bi+FWwMviytr XnY4b+XSs/AidfDpop8e9yl5oKVVmtL3Ps+KCvKK2vvpqsWXWOjeQJd2Syhz3ERz2xtt pGCSdPocudaPuYUvNokPkhocCAppqIq5t4PvOPiF9UluDdNaWfBH++A/57yod1Bnt4JT mAo34ZCMPph2oHb/jaXxu6x/8Mex5M1haxlQvoTRCCymK1j/9SxMXjiL09M+fYb1nGOg wulQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=fMce2IazNc6cYnz84vzjc6+ja0FJnD7qCZDuwBTNyMI=; b=h6O7cbXqjY1wRKt8ag7H3Z7X28uaBEA9Dd4gNZex9c8dmQ4VC4euYOPuVfxHDN5eS3 UALkQVx5gy74LmlHcIKcW03bLOXAfuWDxE6JWD7uaXxXPwPjlewhkbPLH7g8hWGDPUpK O2bJtB9m4OjSApmea8c69H+SUJYFPwffApUabTMW4KE2SUSMvCnkvlzENAw8pmKholXk vDCOz92+Y5B+uO/1eL+tU9IES2vpykubdgmxUYEs/8FeFxm5TbGIjC/WUYoBsIedNG4y Kp+71HWDSf/G93N6z2qTnQgfd82y82xztF27JQsjIrm8wzzRCeXLklpt/ep9hsMuhPqC zj5w== X-Gm-Message-State: AOAM531qSugiuhPnMQQgy86g36fGEaPlrDsxHG6AvSMyWo1dcOLpntHs oJCAq6i3/RQKh3N+CwFp1czlnA== X-Google-Smtp-Source: ABdhPJwR5yut/l9l2rpXL5r4siT7bM+mCVVm4l+VpWe3o6MJ/lKSWwGcN4YZhUOKXZcvonaG92nhhA== X-Received: by 2002:a17:906:1453:: with SMTP id q19mr11942622ejc.111.1594466659625; Sat, 11 Jul 2020 04:24:19 -0700 (PDT) Received: from localhost (ip-86-49-253-141.net.upcbroadband.cz. [86.49.253.141]) by smtp.gmail.com with ESMTPSA id da20sm6707497edb.27.2020.07.11.04.24.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Jul 2020 04:24:18 -0700 (PDT) Date: Sat, 11 Jul 2020 13:24:16 +0200 From: Tomas Vondra To: Sascha Kuhl Cc: Masahiko Sawada , Alexander Korotkov , Michael Paquier , Alvaro Herrera , Tom Lane , Andres Freund , Mark Dilger , pgsql-hackers Subject: Re: WIP: BRIN multi-range indexes Message-ID: <20200711112416.mzyibbacgymhrntb@development> References: <20200402022904.xssjyfupdaj2ejyp@development> <20200405155317.rpmkqdj7far7mwkx@development> <20200405165954.m2odnthc7sbdctwg@development> <20200703005737.dw5i2uwd6i3gv5lf@development> <20200710120914.6kydpi3kfr2icpfq@development> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Jul 10, 2020 at 04:44:41PM +0200, Sascha Kuhl wrote: >Tomas Vondra schrieb am Fr., 10. Juli 2020, >14:09: > >> On Fri, Jul 10, 2020 at 06:01:58PM +0900, Masahiko Sawada wrote: >> >On Fri, 3 Jul 2020 at 09:58, Tomas Vondra >> wrote: >> >> >> >> On Sun, Apr 05, 2020 at 08:01:50PM +0300, Alexander Korotkov wrote: >> >> >On Sun, Apr 5, 2020 at 8:00 PM Tomas Vondra >> >> > wrote: >> >> ... >> >> >> > >> >> >> >Assuming we're not going to get 0001-0003 into v13, I'm not so >> >> >> >inclined to rush on these three as well. But you're willing to >> commit >> >> >> >them, you can count round of review on me. >> >> >> > >> >> >> >> >> >> I have no intention to get 0001-0003 committed. I think those changes >> >> >> are beneficial on their own, but the primary reason was to support >> the >> >> >> new opclasses (which require those changes). And those parts are not >> >> >> going to make it into v13 ... >> >> > >> >> >OK, no problem. >> >> >Let's do this for v14. >> >> > >> >> >> >> Hi Alexander, >> >> >> >> Are you still interested in reviewing those patches? I'll take a look at >> >> 0001-0003 to check that your previous feedback was addressed. Do you >> >> have any comments about 0004 / 0005, which I think are the more >> >> interesting parts of this series? >> >> >> >> >> >> Attached is a rebased version - I realized I forgot to include 0005 in >> >> the last update, for some reason. >> >> >> > >> >I've done a quick test with this patch set. I wonder if we can improve >> >brin_page_items() SQL function in pageinspect as well. Currently, >> >brin_page_items() is hard-coded to support only normal brin indexes. >> >When we pass brin-bloom or brin-multi-range to that function the >> >binary values are shown in 'value' column but it seems not helpful for >> >users. For instance, here is an output of brin_page_items() with a >> >brin-multi-range index: >> > >> >postgres(1:12801)=# select * from brin_page_items(get_raw_page('mul', >> >2), 'mul'); >> >-[ RECORD 1 >> ]---------------------------------------------------------------------------------------------------------------------- >> >> >----------------------------------------------------------------------------------------------------------------------------------- >> >---------------------------- >> >itemoffset | 1 >> >blknum | 0 >> >attnum | 1 >> >allnulls | f >> >hasnulls | f >> >placeholder | f >> >value | >> {\x010000001b0000002000000001000000e5700000e6700000e7700000e8700000e9700000ea700000eb700000ec700000ed700000ee700000ef >> >> >700000f0700000f1700000f2700000f3700000f4700000f5700000f6700000f7700000f8700000f9700000fa700000fb700000fc700000fd700000fe700000ff700 >> >00000710000} >> > >> >> Hmm. I'm not sure we can do much better, without making the function >> much more complicated. I mean, even with regular BRIN indexes we don't >> really know if the value is plain min/max, right? >> >You can be sure with the next node. The value is in can be false positiv. >The value is out is clear. You can detect the change between in and out. > I'm sorry, I don't understand what you're suggesting. How is any of this related to false positive rate, etc? The problem here is that while plain BRIN opclasses have fairly simple summary that can be stored using a fixed number of simple data types (e.g. minmax will store two values with the same data types as the indexd column) result = palloc0(MAXALIGN(SizeofBrinOpcInfo(2)) + sizeof(MinmaxOpaque)); result->oi_nstored = 2; result->oi_opaque = (MinmaxOpaque *) MAXALIGN((char *) result + SizeofBrinOpcInfo(2)); result->oi_typcache[0] = result->oi_typcache[1] = lookup_type_cache(typoid, 0); The opclassed introduced here have somewhat more complex summary, stored as a single bytea value - which is what gets printed by brin_page_items. To print something easier to read (for humans) we'd either have to teach brin_page_items about the diffrent opclasses (multi-range, bloom) end how to parse the summary bytea, or we'd have to extend the opclasses with a function formatting the summary. Or rework how the summary is stored, but that seems like the worst option. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services