Re: Print latency percentiles in pgbench

From: Zakhar Pashkin <kaisenaiko(at)gmail(dot)com>
To: Hữu Đôn Hoàng <hoanghuudon02hp(at)gmail(dot)com>
Cc: Roman Khapov <rkhapov(at)yandex-team(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Print latency percentiles in pgbench
Date: 2026-11-05 18:11:55
Message-ID: CABwha+J3Hj4NZx69c2A+5B=+kGmGgt9+ck_Wy5kKz1wy347JLQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Roman, Don, Phil,

Following Don's review, I put together a supplementary parser and test
patch on top of Roman's October 31 version. i also reproduced the reported
NaN assertion failure.

The patch uses the positive range check Don suggested, retaining the
existing strtod() and errno checks. It adds argument-error tests and short
SELECT 1 runs checking the output labels and formatting. Invalid-input
tests require the percentile diagnostic, exit status 1 and empty stdout;
a connection failure cannot satisfy them. The docs now show explicitly
that a list must be attached with "=".

I left repeated values accepted and preserved the supplied order, with
a test covering both. Is that the intended behavior? The patch also moves
the existing duplicate-option check ahead of both forms and rejects an
empty final list element. Thus bare/bare and explicit/bare repetitions
are rejected consistently, and "--latency-percentiles=50," reports an
invalid list. I can separate those choices from the NaN fix if preferred.

Both complete pgbench TAP tests pass (787 checks) with and without
assertions on Linux x86_64 with GCC 13.3, using master at 627c4df3b73a.
The builds used --enable-tap-tests --without-readline --without-zlib
--without-icu; the assertion build also used --enable-cassert. I have
not tested other platforms.

The attachment applies after the original feature patch.

Regards,
Zakhar Pashkin

Attachment Content-Type Size
v2-0001-pgbench-validate-latency-percentile-options.patch application/octet-stream 8.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ayoub Kazar 2026-11-05 19:07:10 Re: file_fdw: Fix ANALYZE does not enforce REJECT_LIMIT with on_error 'ignore'
Previous Message Narek Galstyan 2026-11-05 18:05:42 Fix btree_gist index corruption on bit and varbit types