Re: Parallel Aggregates for string_agg and array_agg
David Rowley <dgrowleyml@gmail.com>
From: David Rowley <dgrowleyml@gmail.com>
To: Alexander Lakhin <exclusion@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2024-03-27T11:19:06Z
Lists: pgsql-hackers
On Wed, 27 Mar 2024 at 03:00, Alexander Lakhin <exclusion@gmail.com> wrote: > I've discovered that the test query: > -- Ensure parallel aggregation is actually being used. > explain (costs off) select * from v_pagg_test order by y; > > added by 16fd03e95 fails sometimes. For instance: > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=urutu&dt=2024-03-19%2021%3A04%3A05 > > --- /home/bf/bf-build/urutu/HEAD/pgsql/src/test/regress/expected/aggregates.out 2024-02-24 06:42:47.039073180 +0000 > +++ /home/bf/bf-build/urutu/HEAD/pgsql.build/src/test/regress/results/aggregates.out 2024-03-19 22:24:18.155876135 +0000 > @@ -1993,14 +1993,16 @@ > Sort Key: pagg_test.y, (((unnest(regexp_split_to_array((string_agg((pagg_test.x)::text, ','::text)), > ','::text))))::integer) > -> Result > -> ProjectSet > - -> Finalize HashAggregate > + -> Finalize GroupAggregate > ... > > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=phycodurus&dt=2024-02-28%2007%3A38%3A27 > > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=avocet&dt=2024-02-08%2008%3A47%3A45 > > I suspect that these failures caused by autovacuum. I agree with this analysis. In hindsight, adding 5000 records to a table without disabling autovacuum or vacuuming the table manually was a bad idea. I opted to fix by disabling autovacuum for the table as that allows us to maintain the current plan. Vacuuming would result in the plan changing, which I opted not to do as it's a bit more churn in the expected output file. Thanks for the report and the analysis. David
Commits
-
Fix unstable aggregate regression test
- f5d0e866404a 16.3 landed
- d6a6957d53e3 17.0 landed
-
Allow parallel aggregate on string_agg and array_agg
- 16fd03e95654 16.0 landed
-
Improve performance of ORDER BY / DISTINCT aggregates
- 1349d2790bf4 16.0 cited
-
Support ORDER BY within aggregate function calls, at long last providing a
- 34d26872ed81 9.0.0 cited
-
Fix broken markup.
- 6a6efb964092 9.0.0 cited