| From: | Bernd Reiß <bd_reiss(at)gmx(dot)at> |
|---|---|
| To: | Andres Freund <andres(at)anarazel(dot)de>, Michael Paquier <michael(at)paquier(dot)xyz>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, Lukas Fittl <lukas(at)fittl(dot)com> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org, gouda0x(at)gmail(dot)com |
| Subject: | Re: Use instr_time for pg_stat_database block read/write time counters |
| Date: | 2026-10-16 17:21:54 |
| Message-ID: | 22b46c2b-de67-4fae-9aed-39d699720288@gmx.at |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi hackers,
On 02/10/2026 01:16, Andres Freund wrote:
> I think it should actually be a measurable win, due to getting rid of
> INSTR_TIME_GET_MICROSEC(). That's a nontrivial conversion removed from the hot
> path.
>
We tried to benchmark the patch vs master, using the following script:
#! /bin/bash
function bench() {
printenv PG;
pkill -9 postgres
rm -fr temp_db
$PG/initdb temp_db
$PG/pg_ctl -D temp_db -o "-c shared_buffers=128kB -c
track_io_timing=on" start
$PG/pgbench -i -s 100 postgres
$PG/pgbench -S -T 4800 postgres
}
for i in {1..5}; do
PG=base_bin bench
PG=patch_bin bench
done
We used pgbench with a single connection, a single core and tried to get
PG to do as much I/O as possible by having shared_buffers=128kB and
around 1.5GB of data.
And the results we got showed a consistent increase in tps for the
patched version of the binaries:
base_bin: tps = 13304.583036 (without initial connection time)
patch_bin: tps = 13402.525290 (without initial connection time)
base_bin: tps = 13369.510071 (without initial connection time)
patch_bin: tps = 13393.105787 (without initial connection time)
base_bin: tps = 13309.703092 (without initial connection time)
patch_bin: tps = 13440.319286 (without initial connection time)
base_bin: tps = 13363.819694 (without initial connection time)
patch_bin: tps = 13457.270677 (without initial connection time)
base_bin: tps = 13335.492459 (without initial connection time)
patch_bin: tps = 13364.938596 (without initial connection time)
MEDIAN BASE: 13335.492459 tps
MEDIAN PATCHED: 13402.525290 tps
MEAN BASE: 13336.621670 tps
MEAN PATCHED: 13411.631927 tps
Note: we tried the benchmark on different machines with different cpus
and depending on how powerful the cpu is we needed to increase the
runtime duration accordingly, i.e. -T in pgbench, to start noticing a
difference.
Best Regards,
Ahmed Gouda and Bernd Reiß
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Masahiko Sawada | 2026-10-16 17:45:43 | Re: Parallel vacuum: workers together with leader could overrun cost budget |
| Previous Message | Zsolt Parragi | 2026-10-16 17:18:38 | [PG19] Sequence sync stops when the subscription owner can't SET ROLE to a sequence owner |