short circuit suggestion in find_hash_columns()

From: Zhihong Yu <zyu(at)yugabyte(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: short circuit suggestion in find_hash_columns()
Date: 2021-07-09 15:20:04
Message-ID: CALNJ-vQmBS0kLW60gHgH5wifPfhHp5mN2U7HnEtfcqR54Bw+nA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
find-hash-col-short-circuit.patch application/octet-stream 775 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2021-07-09 15:24:33 Re: Record a Bitmapset of non-pruned partitions
Previous Message Domingo Alvarez Duarte 2021-07-09 15:00:29 Re: Grammar railroad diagram