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 1jxB6e-00076t-LP for pgsql-hackers@arkaria.postgresql.org; Sun, 19 Jul 2020 15:20:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jxB6d-00029x-Gx for pgsql-hackers@arkaria.postgresql.org; Sun, 19 Jul 2020 15:19:59 +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 1jxB6d-00029p-5M for pgsql-hackers@lists.postgresql.org; Sun, 19 Jul 2020 15:19:59 +0000 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jxB6W-0003v9-8y for pgsql-hackers@postgresql.org; Sun, 19 Jul 2020 15:19:57 +0000 Received: by mail-ed1-x543.google.com with SMTP id g20so11069341edm.4 for ; Sun, 19 Jul 2020 08:19:52 -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=op2vAMdQW9VsWD6lv5AAgeyAUeIZMzMT6T7cRPt2ib0=; b=2Jdklmrgg6nCKian6znlza3FzPMM8ZvMAu1I8sYBnEHFOij7qNkglQj4zoN2FbjFvf zYbxcSqPzggG6luAhudhSFhK5e+PZylP6CXaQCPt8U00rdf+9+ydobuFt4eRg4UZPzaJ MqDWIUiYXQChOYO/P2GTKjWxbDGx7GErqzfnJiifHkZmCeZjD4Cx7K/p5P4/5FINOvio 4vaNvQeIMi1ujnBIf1AKQPM4AH3mW/s8bAFo3vy2ir4pPS2TLy66oxEKgW23I5JJB01U H5oYks7iH/Mn98Jeg7u+9Qz8ryoSGGj/lE9OXMlgaQNuzZ4AV0GmBVA1u6WHRUnT1Ms8 fLew== 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=op2vAMdQW9VsWD6lv5AAgeyAUeIZMzMT6T7cRPt2ib0=; b=CQpyKAgKPSX3ZV2K9CNCjMUuC2JSvzP997Se3Y4kpLEYkQYDohhBrJ4sfDnbw2Es1r dbQjTvix4NQnzAN697AUFY9CRFzFl1N4apIemBPaFqROqoZGJS8wwrKG/ZAPRS1o4PBA jo9J12pEb9j+970yZw8yUJsJXdLMqZFg78oz0ZEVvrg4AkkAl+kILe3VEc1ellNDX4mf mdO5Xh6JLXmUOWtRAtrTC8BuuvIhgJS3ZVSTkAEMU1s1E1genog3wcYjO1M+6Q75Eg2w tBYqMmLxtd1uVzkaZd8bshndzpBa+b4duwDLQQIzbv4+CCEk/pWF5Usx3DfRSXDCYPlD dbrg== X-Gm-Message-State: AOAM531+3qC06CTo34CEtZ/8299S0T0oixCG1vAlQ06FZ5wYOR4xyunW cjBcuXHRMbTBChGzhiyBIsKJeg== X-Google-Smtp-Source: ABdhPJxhjIlZsl36eaxdvt+ymzhz+0ssiLLJuzO6oQfeH2sSwh070nf8Qxxzfm//BOfhvduX4Vu5Uw== X-Received: by 2002:a50:d784:: with SMTP id w4mr18022230edi.34.1595171990035; Sun, 19 Jul 2020 08:19:50 -0700 (PDT) Received: from localhost (ip-86-49-253-141.net.upcbroadband.cz. [86.49.253.141]) by smtp.gmail.com with ESMTPSA id rv16sm13020141ejb.60.2020.07.19.08.19.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jul 2020 08:19:47 -0700 (PDT) Date: Sun, 19 Jul 2020 17:19:45 +0200 From: Tomas Vondra To: Alexander Korotkov Cc: Masahiko Sawada , Alvaro Herrera , Michael Paquier , Tom Lane , Andres Freund , Mark Dilger , pgsql-hackers Subject: Re: WIP: BRIN multi-range indexes Message-ID: <20200719151945.p6iaexethuplxxic@development> References: <20200713001419.te5aozy7o76ff2vk@development> <20200713003310.GA22495@alvherre.pgsql> <20200713145850.5skhxmqezswz2ovl@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 Wed, Jul 15, 2020 at 05:34:05AM +0300, Alexander Korotkov wrote: >On Mon, Jul 13, 2020 at 5:59 PM Tomas Vondra > wrote: >> >> > If we really want to print something nicer, I'd say it needs to be a >> >> > special function in the BRIN opclass. >> >> >> >> If that can be done, then +1. We just need to ensure that the function >> >> knows and can verify the type of index that the value comes from. I >> >> guess we can pass the index OID so that it can extract the opclass from >> >> catalogs to verify. >> > >> >+1 from me, too. Perhaps we can have it as optional. If a BRIN opclass >> >doesn't have it, the 'values' can be null. >> > >> >> I'd say that if the opclass does not have it, then we should print the >> bytea value (or whatever the opclass uses to store the summary) using >> the type functions. > >I've read the recent messages in this thread and I'd like to share my thoughts. > >I think the way brin_page_items() displays values is not really >generic. It uses a range-like textual representation of an array of >values, while that array doesn't necessarily have range semantics. > >However, I think it's good that brin_page_items() uses a type output >function to display values. So, it's not necessary to introduce a new >BRIN opclass function in order to get values displayed in a >human-readable way. Instead, we could just make a standard of BRIN >value to be human readable. I see at least two possibilities for >that. >1. Use standard container data-types to represent BRIN values. For >instance we could use an array of ranges instead of bytea for >multirange. Not about how convenient/performant it would be. >2. Introduce new data-type to represent values in BRIN index. And for >that type we can define output function with user-readable output. We >did similar things for GiST. For instance, pg_trgm defines gtrgm >type, which has no input and no output. But for BRIN opclass we can >define type with just output. > I think there's a number of weak points in this approach. Firstly, it assumes the summaries can be represented as arrays of built-in types, which I'm not really sure about. It clearly is not true for the bloom opclasses, for example. But even for minmax oclasses it's going to be tricky because the ranges may be on different data types so presumably we'd need somewhat nested data structure. Moreover, multi-minmax summary contains either points or intervals, which requires additional fields/flags to indicate that. That further complicates the things ... maybe we could decompose that into separate arrays or something, but honestly it seems somewhat premature - there are far more important aspects to discuss, I think (e.g. how the ranges are built/merged in multi-minmax, or whether bloom opclasses are useful at all). >BTW, I've applied the patchset to the current master, but I got a lot >of duplicate oids. Could you please resolve these conflicts. I think >it would be good to use high oid numbers to evade conflicts during >development/review, and rely on committer to set final oids (as >discussed in [1]). > >Links >1. https://www.postgresql.org/message-id/CAH2-WzmMTGMcPuph4OvsO7Ykut0AOCF_i-%3DeaochT0dd2BN9CQ%40mail.gmail.com > Did you use the patchset from 2020/07/03? I don't get any duplicate OIDs with it, and it's already using quite high OIDs (part 4 uses >= 8000, part 5 uses >= 9000). regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services