agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pg_test_timing: store timing deltas in int64
Date: Fri, 24 Apr 2026 03:12:58 +0000
Message-ID: <E1wG6yP-002RXO-2k@gemulon.postgresql.org> (raw)

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@highgo.com>
Reviewed-by: Lukas Fittl <lukas@fittl.com>
Reviewed-by: Xiaopeng Wang <wxp_728@163.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.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(-)



Message-ID: <E1wG6yP-002RXO-2k@gemulon.postgresql.org>
Permalink:  ../E1wG6yP-002RXO-2k@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wG6yP-002RXO-2k@gemulon.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: fujii@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: pg_test_timing: store timing deltas in int64
  In-Reply-To: <E1wG6yP-002RXO-2k@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox