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 1hi4we-0002lg-VD for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Jul 2019 22:38:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hi4wc-00077J-W2 for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Jul 2019 22:38:42 +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 1hi4wc-00074n-IW for pgsql-hackers@lists.postgresql.org; Mon, 01 Jul 2019 22:38:42 +0000 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hi4wY-0003gS-Ac for pgsql-hackers@postgresql.org; Mon, 01 Jul 2019 22:38:41 +0000 Received: by mail-pl1-x629.google.com with SMTP id c14so8062633plo.0 for ; Mon, 01 Jul 2019 15:38:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:mime-version :content-transfer-encoding; bh=ho3TqRhNGAR1lEAaAqaG/CoRLEkLimzqcCHDhpXiDGk=; b=kcVh0X0fn9+uEqP/wfEqb1TnW18brXletlacEada2u/ThQ3jiFDCgULXUss+tOE2XE 040VY5wpeg7h+M3D4ndyypU92DKVO2J/1EGF0G1mRdMn+ggx3PE3C85H/uqN1tjTzl+S G9bZnqaDh++l8DECiUcaMgzXYkkqBKxPRz4DdgDmkrK0a0GaZNNgEep7FX/BBNW2DMr/ yJjwg7hlTob8zmfjPRmOsxvN1TQkOamXWxIMIP+rJKliU2rozXvrdPk1JxLkQqqr4eFM iPh7ZAHJxCr0IduMltOR1lCeyLqh1AMJFaJfZwDpyUoyQQbxB78jRp+S/k4xXiSYMmQB qcYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=ho3TqRhNGAR1lEAaAqaG/CoRLEkLimzqcCHDhpXiDGk=; b=qQucNwSHLN2GhYUeJQSGMTDX43pclxCRyqQ3WihV12tZE7e8fZYjsoFdrzFkWG+OuE EcJ06lKRG7kRd5jn9lMELGIHRqr3V0oXwhGttFFgPZgIcO8NZbct9efFtGH3qbdByest PnPENYIbgZUFsjb3vlK9z0SFzscQHwm2xs5JbQvdTKtR8Bnn5KuUfCYdzNyWMY1E4wNB bUKWP/uNxgryxUwRyxZMSvj4XPMt/q4Rycew6hFf36pzfjd6RQSJ/N4vWZlw0R9YC8JK efrwls7Y2Pu5nM9WArBC/5I0xbeGnie/OJduzt0KkC9irz2OlrSot5FHh3tlIzV2et+i CdnA== X-Gm-Message-State: APjAAAX1FCRIQXl9BMPIhrOZ+GP9GQaiyEASqL7/TirTXUE+hWtCj+Y/ ei2gdoD4HbF7aCjY3eK2Z1QL1A== X-Google-Smtp-Source: APXvYqzLqclrKaLhLfm07dFv947CNDzVHenZL1dvPLuCPTc2kn/mdrCRwvw0iGFtmQfdMA+VMr5J+Q== X-Received: by 2002:a17:902:bcc6:: with SMTP id o6mr1834310pls.268.1562020714764; Mon, 01 Jul 2019 15:38:34 -0700 (PDT) Received: from jdavis ([2600:1010:b040:129:c54e:b978:3270:a890]) by smtp.gmail.com with ESMTPSA id t11sm19994933pgb.33.2019.07.01.15.38.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Jul 2019 15:38:33 -0700 (PDT) Message-ID: Subject: Re: range_agg From: Jeff Davis To: Paul Jungwirth , Pgsql Hackers Date: Mon, 01 Jul 2019 15:38:30 -0700 In-Reply-To: <16d71dc8-34cf-5ebd-1ce5-ccd93c0a14f9@illuminatedcomputing.com> References: <16d71dc8-34cf-5ebd-1ce5-ccd93c0a14f9@illuminatedcomputing.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, 2019-05-03 at 15:56 -0700, Paul Jungwirth wrote: > Hello, > > I wrote an extension to add a range_agg function with similar > behavior > to existing *_agg functions, and I'm wondering if folks would like > to > have it in core? Here is the repo: > https://github.com/pjungwir/range_agg This seems like a very useful extension, thank you. For getting into core though, it should be a more complete set of related operations. The patch is implicitly introducing the concept of a "multirange" (in this case, an array of ranges), but it's not making the concept whole. What else should return a multirange? This patch implements the union- agg of ranges, but we also might want an intersection-agg of ranges (that is, the set of ranges that are subranges of every input). Given that there are other options here, the name "range_agg" is too generic to mean union-agg specifically. What can we do with a multirange? A lot of range operators still make sense, like "contains" or "overlaps"; but "adjacent" doesn't quite work. What about new operations like inverting a multirange to get the gaps? Do we want to continue with the array-of-ranges implementation of a multirange, or do we want a first-class multirange concept that might eliminate the boilerplate around defining all of these operations? If we have a more complete set of operators here, the flags for handling overlapping ranges and gaps will be unnecessary. Regards, Jeff Davis