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.92) (envelope-from ) id 1jGb6M-0001TI-8w for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2020 04:23:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jGb6K-0000Lq-OJ for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2020 04:23:40 +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 1jGb6K-0000Lb-C0 for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2020 04:23:40 +0000 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jGb6H-00081z-Iw for pgsql-hackers@postgresql.org; Tue, 24 Mar 2020 04:23:39 +0000 Received: by mail-pg1-x536.google.com with SMTP id t24so8381631pgj.7 for ; Mon, 23 Mar 2020 21:23:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=illuminatedcomputing-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=w2CyxyQa6T/IbhJBo77scPpFqxlp0XGAWEsyN5bW648=; b=kS0/QSTgT0TrnatnH6jSKzamfSOJ5i5NC8a+UPCpW5b09KSeEfOi74xyzdWmZ3pknr K9wi9A1ilvMUKab86nRfnftru5qIO2pYAbwbkWAOU1nZuOH2w4jzDeqrspJkoE23iIfG rvk4AiC5AO08TghiW3DUyndJ648q9C6u5lFYI65rCN/u4CfO1oUyDRSazC7QxbNpiCMm 1jY998SZYOV+oGjUsbie4PpguSqy0yw7wY68p4+u1HWMx0iu/KNNDtr4DsRcYq6WdbUA BPOCMRjNUIaip6aGV7B7Vl7dbK2BZR/UWBBj8xjKKYyGuI2+LyhG56SUR/+BLdN9xQuw KFHg== 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=w2CyxyQa6T/IbhJBo77scPpFqxlp0XGAWEsyN5bW648=; b=CQsFdZEi1U4k03lcS2sfxKcjMUyKFanuMh5MZcvW/0XehKHt5Zjo9SU+a3W74FSNmN adhWvGrFFRecZj8j0UbYlGvIH8m+qgU1QiRyPzdmA60svkU6d3cSZ+0/wSlppbJFgdkE kNJbAWifRqHpuVhuMPbM7uXEYxVN2FQAIAndbXe4Y5zUpxm6Z4/rRDnD44O9KlnGw1IF wdy5Aet+jkIgv9Yqs3Bv1MUjr0Vj+/ds30juyfb/s2hxhXt9gT/eRAPkAB8QZnuDHeTe yeS0GhQ9S/BUA+qT6ZamSto/dSajZZzb1JcADpIP3H3jHOG7v4R7wKSo3ng45hzhM0PU TiVw== X-Gm-Message-State: ANhLgQ30lonIKD3PWWp2ypT6AEp0lTypmWsRlYEDUO9F+wC8LLjE4ElA +ufWqxaa7dCa8g6wbTZVHIRIVg== X-Google-Smtp-Source: ADFU+vtOVAqk1EDLjucMk8xSohritfOkML43mQPxP/tyC7UtvrqkkO/Rk+C9xukNYgplAWjWShuiUQ== X-Received: by 2002:a63:d351:: with SMTP id u17mr25121482pgi.396.1585023815155; Mon, 23 Mar 2020 21:23:35 -0700 (PDT) Received: from [192.168.2.101] (static-50-53-109-254.bvtn.or.frontiernet.net. [50.53.109.254]) by smtp.googlemail.com with ESMTPSA id g14sm14580793pfb.131.2020.03.23.21.23.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 Mar 2020 21:23:34 -0700 (PDT) Subject: Re: range_agg To: Alvaro Herrera Cc: Tom Lane , PostgreSQL-development , Jeff Davis , Pavel Stehule , David Fetter References: <20200323233227.GA5607@alvherre.pgsql> From: Paul Jungwirth Message-ID: <1d40004c-335a-a268-454e-6864e188c852@illuminatedcomputing.com> Date: Mon, 23 Mar 2020 21:23:31 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20200323233227.GA5607@alvherre.pgsql> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Thanks Alvaro! On Mon, Mar 23, 2020 at 4:33 PM Alvaro Herrera wrote: > > Thinking about the on-disk representation, can we do better than putting > the contained ranges in long-varlena format, including padding; also we > include the type OID with each element.  Sounds wasteful.  A more > compact representation might be to allow short varlenas and doing away > with the alignment padding, put the the type OID just once.  This is > important because we cannot change it later. Can you give me some guidance on this? I don't know how to make the on-disk format different from the in-memory format. (And for the in-memory format, I think it's important to have actual RangeTypes inside the multirange.) Is there something in the documentation, or a README in the repo, or even another type I can follow? > I'm also wondering if multirange_in() is the right strategy.  Would it> be sensible to give each range to range_parse or range_parse_bounde, so > that it determines where each range starts and ends?  Then that function > doesn't have to worry about each quote and escape, duplicating range > parsing code.  (This will probably require changing signature of the > rangetypes.c function, and exporting it; for example have > range_parse_bound allow bound_str to be NULL and in that case don't mess > with the StringInfo and just return the end position of the parsed > bound.) Yeah, I really wanted to do it that way originally too. As you say it would require passing back more information from the range-parsing code. I can take a stab at making the necessary changes. I'm a bit more confident now than I was then in changing the range code we have already. Regards, -- Paul ~{:-) pj@illuminatedcomputing.com