pg_stat_io not tracking smgrwriteback() is confusing

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-hackers(at)postgresql(dot)org, Melanie Plageman <melanieplageman(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org>
Subject: pg_stat_io not tracking smgrwriteback() is confusing
Date: 2023-04-19 17:23:26
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


I noticed that the numbers in pg_stat_io dont't quite add up to what I
expected in write heavy workloads. Particularly for checkpointer, the numbers
for "write" in log_checkpoints output are larger than what is visible in

That partially is because log_checkpoints' "write" covers way too many things,
but there's an issue with pg_stat_io as well:

Checkpoints, and some other sources of writes, will often end up doing a lot
of smgrwriteback() calls - which pg_stat_io doesn't track. Nor do any
pre-existing forms of IO statistics.

It seems pretty clear that we should track writeback as well. I wonder if it's
worth doing so for 16? It'd give a more complete picture that way. The
counter-argument I see is that we didn't track the time for it in existing
stats either, and that nobody complained - but I suspect that's mostly because
nobody knew to look.


Andres Freund


Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2023-04-19 17:43:04 Re: Enhanced rmgr desc routines test !has_image, not has_data
Previous Message Robert Haas 2023-04-19 17:16:54 Re: Direct I/O