Re: Show WAL write and fsync stats in pg_stat_io
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Nazir Bilal Yavuz <byavuz81@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, pgsql-hackers <pgsql-hackers@postgresql.org>, "bharath.rupireddyforpostgres@gmail.com"
<bharath.rupireddyforpostgres@gmail.com>, Melanie Plageman <melanieplageman@gmail.com>
Date: 2023-12-26T10:10:41Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix copy-paste error related to the autovacuum launcher in pgstat_io.c
- 17d8bba6dad1 18.0 landed
-
Move SQL tests of pg_stat_io for WAL data to recovery test 029_stats_restart
- 428fadb7e97e 18.0 landed
-
Add data for WAL in pg_stat_io and backend statistics
- a051e71e28a1 18.0 landed
-
Improve comment on top of pgstat_count_io_op_time()
- b998fedab74c 18.0 landed
-
Refactor pgstat_prepare_io_time() with an input argument instead of a GUC
- 3c9d9acae0bc 17.0 landed
On Tue, Dec 26, 2023 at 11:27:16AM +0300, Nazir Bilal Yavuz wrote: > Maybe it is better to create a pg_stat_io_wal view like you said > before. We could remove unused columns and add op_bytes for each > writes and reads. Also, we can track both the number of bytes and the > number of the operations. This doesn't fully solve the problem but it > will be easier to modify it to meet our needs. I am not sure while the whole point of the exercise is to have all the I/O related data in a single view. Something that I've also found a bit disturbing yesterday while looking at your patch is the fact that the operation size is guessed from the context and object type when querying the view because now everything is tied to BLCKSZ. This patch extends it with two more operation sizes, and there are even cases where it may be a variable. Could it be a better option to extend pgstat_count_io_op_time() so as callers can themselves give the size of the operation? The whole patch is kind of itself complicated enough, so I'd be OK to discard the case of the WAL receiver for now. Now, if we do so, the code stack of pgstat_io.c should handle WAL receivers as something entirely disabled until all the known issues are solved. There is still a lot of value in tracking WAL data associated to the WAL writer, normal backends and WAL senders. -- Michael