Re: short circuit suggestion in find_hash_columns()

2021-07-09 Thread Zhihong Yu
On Fri, Jul 9, 2021 at 8:28 AM David Rowley wrote: > On Sat, 10 Jul 2021 at 03:15, Zhihong Yu wrote: > > I was looking at find_hash_columns() in nodeAgg.c > > > > It seems the first loop tries to determine the max column number needed, > along with whether all columns are needed. > > > > The loo

Re: short circuit suggestion in find_hash_columns()

2021-07-09 Thread David Rowley
On Sat, 10 Jul 2021 at 03:15, Zhihong Yu wrote: > I was looking at find_hash_columns() in nodeAgg.c > > It seems the first loop tries to determine the max column number needed, > along with whether all columns are needed. > > The loop can be re-written as shown in the patch. This runs during Exe

short circuit suggestion in find_hash_columns()

2021-07-09 Thread Zhihong Yu
Hi, I was looking at find_hash_columns() in nodeAgg.c It seems the first loop tries to determine the max column number needed, along with whether all columns are needed. The loop can be re-written as shown in the patch. In normal cases, we don't need to perform scanDesc->natts iterations. In bes