Re: range_agg

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Jeff Davis <pgsql(at)j-davis(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, David Fetter <david(at)fetter(dot)org>
Subject: Re: range_agg
Date: 2020-03-23 23:32:27
Message-ID: 20200323233227.GA5607@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 2020-Mar-19, Paul A Jungwirth wrote:

> On Thu, Mar 19, 2020 at 1:43 PM Paul A Jungwirth
> <pj(at)illuminatedcomputing(dot)com> wrote:
> > On Thu, Mar 19, 2020 at 1:42 PM Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> wrote:
> > > There's been another flurry of commits in the polymorphic types area.
> > > Can you please rebase again?
> >
> > I noticed that too. :-) I'm about halfway through a rebase right now.
> > I can probably finish it up tonight.
> Here is that patch. I should probably add an anycompatiblemultirange
> type now too? I'll get started on that tomorrow.

Thanks for the new version. Here's a few minor adjustments while I
continue to read through it.

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.

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

Álvaro Herrera
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
0001-Fix-typo.patch text/x-diff 987 bytes
0002-Remove-trailing-useless.patch text/x-diff 766 bytes
0003-reduce-palloc-strlcpy-to-pnstrdup.patch text/x-diff 1.0 KB
0004-silence-compiler-warning.patch text/x-diff 1.6 KB
0005-rename-get_range_multirange_subtype-to-get_multirang.patch text/x-diff 4.4 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2020-03-23 23:50:36 Autovacuum vs vac_update_datfrozenxid() vs ?
Previous Message Stephen Frost 2020-03-23 22:50:54 Re: GSoC chat link not working