pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Davis <pgsql@j-davis.com>
To: Paul Jungwirth <pj@illuminatedcomputing.com>
To: Pgsql Hackers <pgsql-hackers@postgresql.org>
Subject: Re: range_agg
Date: Mon, 01 Jul 2019 15:38:30 -0700
Message-ID: <ba323e489b98029be5ba2d5c5cbc99795f333f48.camel@j-davis.com> (raw)
In-Reply-To: <16d71dc8-34cf-5ebd-1ce5-ccd93c0a14f9@illuminatedcomputing.com>
References: <16d71dc8-34cf-5ebd-1ce5-ccd93c0a14f9@illuminatedcomputing.com>

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







view thread (152+ messages)  latest in thread

Message-ID: <ba323e489b98029be5ba2d5c5cbc99795f333f48.camel@j-davis.com>
Permalink:  ../ba323e489b98029be5ba2d5c5cbc99795f333f48.camel@j-davis.com/
Also on:    postgresql.org/message-id/ba323e489b98029be5ba2d5c5cbc99795f333f48.camel@j-davis.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: pgsql@j-davis.com, pj@illuminatedcomputing.com
  Subject: Re: range_agg
  In-Reply-To: <ba323e489b98029be5ba2d5c5cbc99795f333f48.camel@j-davis.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox