Hi Hackers,

I just want to discuss adding of a new statistics view that provides
the information of wal writing details as follows

postgres=# \d pg_stat_wal_writer
                        View "pg_catalog.pg_stat_wal_writer"
        Column         |           Type           | Collation | Nullable |
 num_backend_writes       | bigint                   |           |
 num_total_writes  | bigint                   |           |          |
 num_blocks  | bigint                   |           |          |
 total_write_time   | bigint|           |          |
 stats_reset           | timestamp with time zone |           |          |

The columns of the view are
1. Total number of xlog writes that are called from the backend.
2. Total number of xlog writes that are called from both backend
 and background workers. (This column can be changed to just
 display on the background writes).
3. The number of the blocks that are written.
4. Total write_time of the IO operation it took, this variable data is
filled only when the track_io_timing GUC is enabled.
5. Last time when the stats are reset.

I feel this view information may be useful in finding out how much
time does backend may spend in writing the xlog, based on this
information, it may be possible to tune wal_writer_delay GUC.

Or it is possible to integrate the new columns into the existing
pg_stat_bgwriter view also.


Hari Babu
Fujitsu Australia

Reply via email to