Re: MAP syntax for arrays - Mailing list pgsql-hackers

From Tom Lane
Subject Re: MAP syntax for arrays
Date
Msg-id 16428.1525706171@sss.pgh.pa.us
Whole thread Raw
In response to Re: MAP syntax for arrays  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
Responses Re: MAP syntax for arrays  (Ildar Musin <i.musin@postgrespro.ru>)
List pgsql-hackers
Ashutosh Bapat <ashutosh.bapat@enterprisedb.com> writes:
> Is there a way we can improve unnest() and array_agg() to match the
> performance you have specified by let's say optimizing the cases
> specially when those two are used together. Identifying that may be
> some work, but will not require introducing new syntax.

+1.  The first thing I thought on seeing this proposal was "I wonder
how long it will be before the SQL committee introduces some syntax
that uses the MAP keyword and breaks this".

ISTM the planner could be taught to notice the combination of unnest
and array_agg and produce a special output plan from that.

It is, however, fair to wonder whether this is worth our time to
optimize.  I've not noticed a lot of people complaining about
performance of this sort of thing, at least not since we fixed
array_agg to not be O(N^2).

            regards, tom lane


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [HACKERS] Clock with Adaptive Replacement
Next
From: Alexander Korotkov
Date:
Subject: Re: doc fixes: vacuum_cleanup_index_scale_factor