Re: Default setting for enable_hashagg_disk
Peter Geoghegan <pg@bowt.ie>
From: Peter Geoghegan <pg@bowt.ie>
To: Stephen Frost <sfrost@snowman.net>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Jeff Davis <pgsql@j-davis.com>, Alvaro Herrera <alvherre@2ndquadrant.com>,
Andres Freund <andres@anarazel.de>, Bruce Momjian <bruce@momjian.us>, Robert Haas <robertmhaas@gmail.com>, David Rowley <dgrowleyml@gmail.com>, Justin Pryzby <pryzby@telsasoft.com>, Melanie Plageman <melanieplageman@gmail.com>,
Tomas Vondra <tomas.vondra@2ndquadrant.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2020-07-11T16:49:43Z
Lists: pgsql-hackers, pgsql-docs
On Sat, Jul 11, 2020 at 7:22 AM Stephen Frost <sfrost@snowman.net> wrote: > * Tom Lane (tgl@sss.pgh.pa.us) wrote: > > Have you got a better proposal that is reasonably implementable for v13? > > (I do not accept the argument that "do nothing" is a better proposal.) > So, no, I don't agree that 'do nothing' (except ripping out the one GUC > that was already added) is a worse proposal than adding another work_mem > like thing that's only for some nodes types. The question was "Have you got a better proposal that is reasonably implementable for v13?". This is anecdotal, but just today somebody on Twitter reported *increasing* work_mem to stop getting OOMs from group aggregate + sort: https://twitter.com/theDressler/status/1281942941133615104 It was possible to fix the problem in this instance, since evidently there wasn't anything else that really did try to consume ~5 GB of work_mem memory. Evidently the memory isn't available in any general sense, so there are no OOMs now. Nevertheless, we can expect OOMs on this server just as soon as there is a real need to do a ~5GB sort, regardless of anything else. I don't think that this kind of perverse effect is uncommon. Hash aggregate can naturally be far faster than group agg + sort, Hash agg can naturally use a lot less memory in many cases, and we have every reason to think that grouping estimates are regularly totally wrong. You're significantly underestimating the risk. -- Peter Geoghegan
Commits
-
Add hash_mem_multiplier GUC.
- d6c08e29e7bc 14.0 landed
- 78530c8e7a5a 13.0 landed
-
HashAgg: use better cardinality estimate for recursive spilling.
- 3a232a3183d5 13.0 landed
- 9878b643f37b 14.0 landed
-
Remove hashagg_avoid_disk_plan GUC.
- bcbf9446a298 14.0 landed
- 5a6cc6ffa914 13.0 landed
-
Doc fixup for hashagg_avoid_disk_plan GUC.
- d33f33539d7f 13.0 landed
- 7ce461560159 14.0 landed
-
Rework HashAgg GUCs.
- 13e0fa7ae50c 13.0 landed
- 92c58fd94801 14.0 landed
-
Disk-based Hash Aggregation.
- 1f39bce02154 13.0 cited
-
Implement partition-wise grouping/aggregation.
- e2f1eb0ee30d 11.0 cited
-
Defer creation of partially-grouped relation until it's needed.
- 4f15e5d09de2 11.0 cited