RE: About to add WAL write/fsync statistics to pg_stat_wal view

From: Masahiro Ikeda <ikedamsh(at)oss(dot)nttdata(dot)com>
To: kuroda(dot)hayato(at)fujitsu(dot)com
Cc: japin <japinli(at)hotmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: About to add WAL write/fsync statistics to pg_stat_wal view
Date: 2021-01-25 03:53:05
Message-ID: b0a86f34c9580bf418419b515f11769a@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021-01-25 10:34, kuroda(dot)hayato(at)fujitsu(dot)com wrote:
> Dear Ikeda-san,
>
> Thank you for updating the patch. This can be applied to master, and
> can be used on my RHEL7.
> wal_write_time and wal_sync_time increase normally :-).
>
> ```
> postgres=# select * from pg_stat_wal;
> -[ RECORD 1 ]----+------------------------------
> wal_records | 121781
> wal_fpi | 2287
> wal_bytes | 36055146
> wal_buffers_full | 799
> wal_write | 12770
> wal_write_time | 4.469
> wal_sync | 11962
> wal_sync_time | 132.352
> stats_reset | 2021-01-25 00:51:40.674412+00
> ```

Thanks for checking.

> I put a further comment:
>
> ```
> @@ -3485,7 +3485,53 @@ SELECT pid, wait_event_type, wait_event FROM
> pg_stat_activity WHERE wait_event i
> <structfield>wal_buffers_full</structfield> <type>bigint</type>
> </para>
> <para>
> - Number of times WAL data was written to disk because WAL
> buffers became full
> + Total number of times WAL data was written to disk because WAL
> buffers became full
> + </para></entry>
> + </row>
> +
> + <row>
> + <entry role="catalog_table_entry"><para
> role="column_definition">
> + <structfield>wal_write</structfield> <type>bigint</type>
> + </para>
> + <para>
> + Total number of times WAL data was written to disk
> + </para></entry>
> + </row>
> +
> + <row>
> + <entry role="catalog_table_entry"><para
> role="column_definition">
> + <structfield>wal_write_time</structfield> <type>double
> precision</type>
> + </para>
> + <para>
> + Total amount of time that has been spent in the portion of
> + WAL data was written to disk, in milliseconds
> + (if <xref linkend="guc-track-wal-io-timing"/> is enabled,
> otherwise zero).
> + </para></entry>
> + </row>
> +
> + <row>
> + <entry role="catalog_table_entry"><para
> role="column_definition">
> + <structfield>wal_sync</structfield> <type>bigint</type>
> + </para>
> + <para>
> + Total number of times WAL data was synced to disk
> + (if <xref linkend="guc-wal-sync-method"/> is
> <literal>open_datasync</literal> or
> + <literal>open_sync</literal>, this value is zero because WAL
> data is synced
> + when to write it).
> + </para></entry>
> + </row>
> +
> + <row>
> + <entry role="catalog_table_entry"><para
> role="column_definition">
> + <structfield>wal_sync_time</structfield> <type>double
> precision</type>
> + </para>
> + <para>
> + Total amount of time that has been spent in the portion of
> + WAL data was synced to disk, in milliseconds
> + (if <xref linkend="guc-track-wal-io-timing"/> is enabled,
> otherwise zero.
> + if <xref linkend="guc-wal-sync-method"/> is
> <literal>open_datasync</literal> or
> + <literal>open_sync</literal>, this value is zero too because
> WAL data is synced
> + when to write it).
> </para></entry>
> </row>
> ```
>
> Maybe "Total amount of time" should be used, not "Total number of
> time."
> Other views use "amount."

Thanks.

I checked columns' descriptions of other views.
There are "Number of xxx", "Total number of xxx", "Total amount of time
that xxx" and "Total time spent xxx".

Since the "time" is used for showing spending time, not count,
I'll change it to "Total number of WAL data written/synced to disk".
Thought?

Regards,
--
Masahiro Ikeda
NTT DATA CORPORATION

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-01-25 03:54:25 Re: Single transaction in the tablesync worker?
Previous Message Greg Nancarrow 2021-01-25 03:46:03 Re: Parallel INSERT (INTO ... SELECT ...)