Hi, This is a WIP patch to add WAL write and fsync stats to pg_stat_io view. There is a track_io_timing variable to control pg_stat_io timings and a track_wal_io_timing variable to control WAL timings. I couldn't decide on which logic to enable WAL timings on pg_stat_io. For now, both pg_stat_io and track_wal_io_timing are needed to be enabled to track WAL timings in pg_stat_io.
Also, if you compare WAL stats in pg_stat_wal and pg_stat_io; you can come across differences. These differences are caused by the background writer's WAL stats not being flushed. Because of that, background writer's WAL stats are not seen in pg_stat_wal but in pg_stat_io. I already sent a patch [1] to fix that. [1] https://www.postgresql.org/message-id/CAN55FZ2FPYngovZstr%3D3w1KSEHe6toiZwrurbhspfkXe5UDocg%40mail.gmail.com Any kind of feedback would be appreciated. Regards, Nazir Bilal Yavuz Microsoft
v1-0001-WIP-Show-WAL-write-and-fsync-stats-on-pg_stat_io.patch
Description: Binary data