Restrict data checksums entries in pg_stat_io

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Restrict data checksums entries in pg_stat_io
Date: 2026-07-10 03:13:37
Message-ID: CAHGQGwHz_-nt+YkHDMRZNBZrnoHro8cMOgSwuXEmSYT6vxgQ=w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

While reviewing the data checksums docs at [1], I found that the data checksums
launcher and workers are exposed in pg_stat_io with the same broad set of
object/context combinations as general background workers.

However, several of those entries can never accumulate I/O statistics.
For example, as far as I understand correctly, the launcher never processes
relations itself, and the workers neither operate on temporary relations nor
use the bulkread or bulkwrite contexts. So I think it would be better to
restrict the reported entries to those that the data checksums processes
can actually use.

The attached patch teaches pgstat_tracks_io_object() and pgstat_tracks_io_op()
about the actual I/O paths used by these processes. After the patch,
pg_stat_io includes only:

- data checksums launcher: relation/normal, wal/init, wal/normal
- data checksums worker: relation/normal, relation/vacuum, wal/init, wal/normal

The patch also excludes WAL reads for both processes, since they emit
WAL records but never read WAL.

Thoughts?

Regards,

[1] https://postgr.es/m/CAHGQGwFsBjQs2fv7b72hxzGV_fJMh6LAg4E83pNfDOu1jVgWCA@mail.gmail.com

--
Fujii Masao

Attachment Content-Type Size
v1-0001-Restrict-pg_stat_io-entries-for-data-checksum-pro.patch application/octet-stream 3.7 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Haibo Yan 2026-07-10 04:07:58 Re: [PATCH] ecpg: use memcpy in a few length-based copies
Previous Message Xuneng Zhou 2026-07-10 03:07:39 Re: Fix Grammar in Buffer Lock Wait Message