On Fri, 2020-03-27 at 02:31 +0100, Tomas Vondra wrote: > On Thu, Mar 26, 2020 at 05:56:56PM +0800, Richard Guo wrote: > > If nbatches is some number between 1.0 and 2.0, we would have a > > negative > > depth. As a result, we may have a negative cost for hash > > aggregation > > plan node, as described in [1]. > > numGroups / ngroups_limit ); > > and we should probably do > > nbatches = ceil(nbatches); >
Thank you both. I also protected against nbatches == 0 (shouldn't happen), and against num_partitions <= 1. That allowed me to remove the conditional and simplify a bit. Regards, Jeff Davis