RE: About to add WAL write/fsync statistics to pg_stat_wal view - Mailing list pgsql-hackers

From Masahiro Ikeda
Subject RE: About to add WAL write/fsync statistics to pg_stat_wal view
Date
Msg-id b0a86f34c9580bf418419b515f11769a@oss.nttdata.com
Whole thread Raw
In response to RE: About to add WAL write/fsync statistics to pg_stat_wal view  ("kuroda.hayato@fujitsu.com" <kuroda.hayato@fujitsu.com>)
Responses RE: About to add WAL write/fsync statistics to pg_stat_wal view  ("kuroda.hayato@fujitsu.com" <kuroda.hayato@fujitsu.com>)
List pgsql-hackers
On 2021-01-25 10:34, kuroda.hayato@fujitsu.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



pgsql-hackers by date:

Previous
From: Greg Nancarrow
Date:
Subject: Re: Parallel INSERT (INTO ... SELECT ...)
Next
From: Amit Kapila
Date:
Subject: Re: Single transaction in the tablesync worker?