sql: create new aggregate function array_concat_agg #97502
Labels
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
T-sql-queries
SQL Queries Team
Is your feature request related to a problem? Please describe.
Currently, if you want to aggregate multiple arrays from different rows into a single array, you first need to
unnest
all the arrays, and then re-aggregate them usingarray_agg
. This often requires aLATERAL
join, which may not be possible to decorrelate, resulting in a very inefficient plan. This issue is currently affecting the performance of the SQL activity page in the DB console.Describe the solution you'd like
We should create a new builtin aggregate function called
array_concat_agg
, that allows a user to directly aggregate a set of arrays into a single array.Describe alternatives you've considered
The alternative is to continue using
unnest
+array_agg
, which as described above, is inefficient.cc @maryliag
Jira issue: CRDB-24730
The text was updated successfully, but these errors were encountered: