From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Paul A Jungwirth <pj@illuminatedcomputing.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Jeff Davis <pgsql@j-davis.com>
Cc: Pgsql Hackers <pgsql-hackers@postgresql.org>
Subject: Re: range_agg
Date: Wed, 4 Mar 2020 18:33:21 -0300
Message-ID: <20200304213321.GA23016@alvherre.pgsql> (raw)
In-Reply-To: <20200304022849.GA5402@alvherre.pgsql>
I came across an interesting thing, namely multirange_canonicalize()'s
use of qsort_arg with a callback of range_compare(). range_compare()
calls range_deserialize() (non-trivial parsing) for each input range;
multirange_canonicalize() later does a few extra deserialize calls of
its own. Call me a premature optimization guy if you will, but I think
it makes sense to have a different struct (let's call it
"InMemoryRange") which stores the parsed representation of each range;
then we can deserialize all ranges up front, and use that as many times
as needed, without having to deserialize each range every time.
While I'm at this, why not name the new file simply multiranges.c
instead of multirangetypes.c?
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
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: alvherre@2ndquadrant.com, pj@illuminatedcomputing.com, tgl@sss.pgh.pa.us, pavel.stehule@gmail.com, pgsql@j-davis.com
Subject: Re: range_agg
In-Reply-To: <20200304213321.GA23016@alvherre.pgsql>
* 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