Re: Fix incorrect comments in tuplesort.c - Mailing list pgsql-hackers

From Chao Li
Subject Re: Fix incorrect comments in tuplesort.c
Date
Msg-id 54DB79FF-2FE4-4CBC-B639-E50C027EFADF@gmail.com
Whole thread Raw
In response to Re: Fix incorrect comments in tuplesort.c  (David Rowley <dgrowleyml@gmail.com>)
List pgsql-hackers

> On Dec 8, 2025, at 08:28, David Rowley <dgrowleyml@gmail.com> wrote:
>
> + * in grow_memtuples().  However, we don't consider array sizes
> + * less than 1024.
>
> Using "However" here indicates some exception to what's just been
> said, but there is no longer an exception. To write about what the
> 1024 is for, we might need to reverse engineer what that's for. I
> assume it's something like "Clamp at 1024 elements to avoid excessive
> reallocs of the array". Or perhaps that without the " of the array"
> part.

+1 for the “however” concern.

Also, I found 8ea3e7a75c might explain why we want initial memtuples array size to exceed ALLOCSET_SEPARATE_THRESHOLD.
That'sbecause we want to avoid switching between block chunk and separate chunk when growing. 

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/







pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Fix incorrect comments in tuplesort.c
Next
From: Michael Paquier
Date:
Subject: Re: Extended Statistics set/restore/clear functions.