Re: AllocSetEstimateChunkSpace()

2020-03-25 Thread Jeff Davis
On Wed, 2020-03-25 at 15:09 -0700, Andres Freund wrote: > > The overhead comes from two places: (a) the chunk header; and (b) > > the > > round-up-to-nearest-power-of-two behavior. > > > > Combining the group tuple and per-group states only saves the > > overhead > > from (a); it does nothing to h

Re: AllocSetEstimateChunkSpace()

2020-03-25 Thread Andres Freund
Hi, On 2020-03-25 14:43:43 -0700, Jeff Davis wrote: > On Wed, 2020-03-25 at 12:42 -0700, Andres Freund wrote: > > As mention on im/call: I think this is mainly an argument for > > combining > > the group tuple & per-group state allocations. I'm kind of fine with > > afterwards taking the allocator

Re: AllocSetEstimateChunkSpace()

2020-03-25 Thread Jeff Davis
On Wed, 2020-03-25 at 12:42 -0700, Andres Freund wrote: > As mention on im/call: I think this is mainly an argument for > combining > the group tuple & per-group state allocations. I'm kind of fine with > afterwards taking the allocator overhead into account. The overhead comes from two places: (a

Re: AllocSetEstimateChunkSpace()

2020-03-25 Thread Andres Freund
Hi, On 2020-03-24 18:12:03 -0700, Jeff Davis wrote: > Attached is a small patch that introduces a simple function, > AllocSetEstimateChunkSpace(), and uses it to improve the estimate for > the size of a hash entry for hash aggregation. > > Getting reasonable estimates for the hash entry size (inc

Re: AllocSetEstimateChunkSpace()

2020-03-25 Thread Jeff Davis
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 memor