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-13T16:20:32Z
Lists: pgsql-hackers, pgsql-docs
On Mon, Jul 13, 2020 at 6:13 AM Stephen Frost <sfrost@snowman.net> wrote: > Yes, increasing work_mem isn't unusual, at all. It's unusual as a way of avoiding OOMs! > Eh? That's not at all what it looks like- they were getting OOM's > because they set work_mem to be higher than the actual amount of memory > they had and the Sort before the GroupAgg was actually trying to use all > that memory. The HashAgg ended up not needing that much memory because > the aggregated set wasn't actually that large. If anything, this shows > exactly what Jeff's fine work here is (hopefully) going to give us- the > option to plan a HashAgg in such cases, since we can accept spilling to > disk if we end up underestimate, or take advantage of that HashAgg > being entirely in memory if we overestimate. I very specifically said that it wasn't a case where something like hash_mem would be expected to make all the difference. > Having looked back, I'm not sure that I'm really in the minority > regarding the proposal to add this at this time either- there's been a > few different comments that it's too late for v13 and/or that we should > see if we actually end up with users seriously complaining about the > lack of a separate way to specify the memory for a given node type, > and/or that if we're going to do this then we should have a broader set > of options covering other nodes types too, all of which are positions > that I agree with. By proposing to do nothing at all, you are very clearly in a small minority. While (for example) I might have debated the details with David Rowley a lot recently, and you couldn't exactly say that we're in agreement, our two positions are nevertheless relatively close together. AFAICT, the only other person that has argued that we should do nothing (have no new GUC) is Bruce, which was a while ago now. (Amit said something similar, but has since softened his opinion [1]). [1] https://postgr.es.m/m/CAA4eK1+KMSQuOq5Gsj-g-pYec_8zgGb4K=xRznbCccnaumFqSA@mail.gmail.com -- 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