Allow parallel aggregate on string_agg and array_agg
authorDavid Rowley <drowley@postgresql.org>
Mon, 23 Jan 2023 04:35:01 +0000 (17:35 +1300)
committerDavid Rowley <drowley@postgresql.org>
Mon, 23 Jan 2023 04:35:01 +0000 (17:35 +1300)
commit16fd03e956540d1b47b743f6a84f37c54ac93dd4
tree5d4e04184fcc5e119b92d48529b60bc160f99633
parent5a3a95385bd5a8f1a4fd50545b7efe9338581899
Allow parallel aggregate on string_agg and array_agg

This adds combine, serial and deserial functions for the array_agg() and
string_agg() aggregate functions, thus allowing these aggregates to
partake in partial aggregations.  This allows both parallel aggregation to
take place when these aggregates are present and also allows additional
partition-wise aggregation plan shapes to include plans that require
additional aggregation once the partially aggregated results from the
partitions have been combined.

Author: David Rowley
Reviewed-by: Andres Freund, Tomas Vondra, Stephen Frost, Tom Lane
Discussion: https://postgr.es/m/CAKJS1f9sx_6GTcvd6TMuZnNtCh0VhBzhX6FZqw17TgVFH-ga_A@mail.gmail.com
13 files changed:
doc/src/sgml/func.sgml
src/backend/optimizer/prep/prepagg.c
src/backend/parser/parse_agg.c
src/backend/utils/adt/array_userfuncs.c
src/backend/utils/adt/arrayfuncs.c
src/backend/utils/adt/varlena.c
src/include/catalog/catversion.h
src/include/catalog/pg_aggregate.dat
src/include/catalog/pg_proc.dat
src/include/parser/parse_agg.h
src/include/utils/array.h
src/test/regress/expected/aggregates.out
src/test/regress/sql/aggregates.sql