pgsql: pg_test_timing: store timing deltas in int64

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_test_timing: store timing deltas in int64
Date: 2026-04-24 03:12:58
Message-ID: E1wG6yP-002RXO-2k@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pg_test_timing: store timing deltas in int64

Commit 0b096e379e6 changed pg_test_timing to measure timing
differences in nanoseconds instead of microseconds, but the resulting
deltas continued to be stored in int32.

That can overflow for large gaps (for example, values greater than about
2.14 seconds in nanoseconds), leading to truncation or incorrect output.

This commit fixes the issue by storing measured timing deltas in int64.
This prevents overflow for large values and better matches
nanosecond-resolution measurements.

Author: Chao Li <lic(at)highgo(dot)com>
Reviewed-by: Lukas Fittl <lukas(at)fittl(dot)com>
Reviewed-by: Xiaopeng Wang <wxp_728(at)163(dot)com>
Reviewed-by: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Discussion: https://postgr.es/m/F780CEEB-A237-4302-9F55-60E9D8B6533D@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/863c4b827d92879dbd526a43a23c33fa9bd23b4f

Modified Files
--------------
src/bin/pg_test_timing/pg_test_timing.c | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2026-04-24 06:23:23 pgsql: Check for stack overflow when rewriting graph queries
Previous Message David Rowley 2026-04-24 02:05:45 pgsql: Fix incorrect logic for hashed IN / NOT IN with non-strict opera