Re: AllocSetEstimateChunkSpace()
Jeff Davis <pgsql@j-davis.com>
From: Jeff Davis <pgsql@j-davis.com>
To: pgsql-hackers@postgresql.org
Cc: Andres Freund <andres@anarazel.de>
Date: 2020-03-25T18:46:31Z
Lists: pgsql-hackers
Attachments
- EstimateMemoryChunkSpace.patch (text/x-patch) patch
On Tue, 2020-03-24 at 18:12 -0700, Jeff Davis wrote: > I considered making it a method of a memory context, but the planner > will call this function before the hash agg memory context is > created. I implemented this approach also; attached. It works a little better by having access to the memory context, so it knows set->allocChunkLimit. It also allows it to work with the slab allocator, which needs the memory context to return a useful number. However, this introduces more code and awkwardly needs to use CurrentMemoryContext when called from the planner (because the actual memory context we're try to estimate for doesn't exist yet). I slightly favor the previous approach (mentioned in the parent email) because it's simple and effective. But I'm fine with this one if someone thinks it will be better for other use cases. Regards, Jeff Davis
Commits
-
Include chunk overhead in hash table entry size estimate.
- 0588ee63aa2d 13.0 landed