Re: pg_test_timing: fix unit typo and widen diff type - Mailing list pgsql-hackers

From Chao Li
Subject Re: pg_test_timing: fix unit typo and widen diff type
Date
Msg-id 21E668C0-CEAE-44F8-B585-319F31883AFE@gmail.com
Whole thread
In response to Re: pg_test_timing: fix unit typo and widen diff type  (Fujii Masao <masao.fujii@gmail.com>)
List pgsql-hackers

> On Apr 23, 2026, at 00:11, Fujii Masao <masao.fujii@gmail.com> wrote:
>
> On Wed, Apr 22, 2026 at 5:58 PM Chao Li <li.evan.chao@gmail.com> wrote:
>> PFA v4:
>>
>> * 0001 unchanged from v3.
>> * 0002 changed size of histogram[] 64.
>
> Thanks for updating the patch!
>
> Since patch 0001 is a bug fix, it should be backpatched to the supported stable
> branches. However, in v19 the unit should be changed like s/ms/ns, while in v18
> and earlier s/ms/us, since those older branches report the diff in microseconds.
> Right?

I just checked old branches. Looks like 0001 can be back-patched down to v10. Yes, pre-19, all branches use
microsecond,so the back-patch should change “ms” to “us”. 

I have helped create back-patch diff files as attached:

* nocfbot.v10-v13.pg_test_timing-backpatch.diff for v10-v13
* nocfbot.v14-v15.pg_test_timing-backpatch.diff for v14-v15
* nocfbot.v16-v18.pg_test_timing-backpatch.diff for v16-v18

For v16 to v18, we can make a tiny improvement by replacing “1e9” with a constant macro NS_PER_S. This change has been
includedin the diff. 

I have built and tested on all branches.

>
> Patch 0002 looks more like an improvement than a bug fix, so we should probably
> wait for the next CommitFest before committing it. Thoughts?
>

I see 0002 a bit differently. In v19, the unit changed from microseconds to nanoseconds, which introduced a potential
overflow:nanoseconds require int64, but the local variable remained int32. So I think this is actually a v19-only bug. 

PFA v5: 0001 replaced “1e9” with NS_PER_S; 0002 unchanged.

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





Attachment

pgsql-hackers by date:

Previous
From: Peter Smith
Date:
Subject: Re: Parallel Apply
Next
From: Haibo Yan
Date:
Subject: Re: Implement missing join selectivity estimation for range types