Re: range_agg extremely slow compared to naive implementation in obscure circumstances

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: David Rowley <dgrowleyml@gmail.com>, Pavel Stehule <pavel.stehule@gmail.com>, Duncan Sands <duncan.sands@deepbluecap.com>, pgsql-bugs@lists.postgresql.org
Date: 2023-02-01T14:51:11Z
Lists: pgsql-bugs
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> On 2023-Jan-31, David Rowley wrote:
>> It might be better if we had multirange_canonicalize() deserialize
>> these once and used some representation that could more easily be
>> qsorted. I'm not planning on doing any work on it though.

> Yeah, maybe it would be possible to have an in-memory representation
> that doesn't require any deparsing, and keep the compact representation
> to be used only for in-data-page storage.  How to do this within the
> constraints of the Datum abstraction is not clear to me.

Perhaps the "expanded datum" mechanism would serve?

src/include/utils/expandeddatum.h

It might be too heavyweight for this application, but I'm not sure.

			regards, tom lane