short circuit suggestion in find_hash_columns() - Mailing list pgsql-hackers

From Zhihong Yu
Subject short circuit suggestion in find_hash_columns()
Date
Msg-id CALNJ-vQmBS0kLW60gHgH5wifPfhHp5mN2U7HnEtfcqR54Bw+nA@mail.gmail.com
Whole thread Raw
Responses Re: short circuit suggestion in find_hash_columns()
List pgsql-hackers
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 best case scenario, the loop would terminate after two iterations.

Please provide your comment.

Thanks
Attachment

pgsql-hackers by date:

Previous
From: Domingo Alvarez Duarte
Date:
Subject: Re: Grammar railroad diagram
Next
From: David Rowley
Date:
Subject: Re: Record a Bitmapset of non-pruned partitions