Re: Introduce a new view for checkpointer related stats - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: Introduce a new view for checkpointer related stats
Date
Msg-id CALj2ACV-s5gzuCpt7uXkRJkFhcGPKrv8eZqKOaEmsRFLCXqVoQ@mail.gmail.com
Whole thread Raw
In response to Re: Introduce a new view for checkpointer related stats  ("Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>)
Responses Re: Introduce a new view for checkpointer related stats
List pgsql-hackers
On Wed, Nov 30, 2022 at 12:44 PM Drouvot, Bertrand
<bertranddrouvot.pg@gmail.com> wrote:
>
> +CREATE VIEW pg_stat_checkpointer AS
> +    SELECT
> +        pg_stat_get_timed_checkpoints() AS checkpoints_timed,
> +        pg_stat_get_requested_checkpoints() AS checkpoints_req,
> +        pg_stat_get_checkpoint_write_time() AS checkpoint_write_time,
> +        pg_stat_get_checkpoint_sync_time() AS checkpoint_sync_time,
> +        pg_stat_get_buf_written_checkpoints() AS buffers_checkpoint,
> +        pg_stat_get_buf_written_backend() AS buffers_backend,
> +        pg_stat_get_buf_fsync_backend() AS buffers_backend_fsync,
> +        pg_stat_get_checkpointer_stat_reset_time() AS stats_reset;
> +
>
> I still think that having checkpoints_ prefix in a pg_stat_checkpointer view sounds "weird" (made sense when they
werepart of pg_stat_bgwriter)
 
>
> maybe we could have something like this instead?
>
> +CREATE VIEW pg_stat_checkpointer AS
> +    SELECT
> +        pg_stat_get_timed_checkpoints() AS num_timed,
> +        pg_stat_get_requested_checkpoints() AS num_req,
> +        pg_stat_get_checkpoint_write_time() AS total_write_time,
> +        pg_stat_get_checkpoint_sync_time() AS total_sync_time,
> +        pg_stat_get_buf_written_checkpoints() AS buffers_checkpoint,
> +        pg_stat_get_buf_written_backend() AS buffers_backend,
> +        pg_stat_get_buf_fsync_backend() AS buffers_backend_fsync,
> +        pg_stat_get_checkpointer_stat_reset_time() AS stats_reset;
> +

I don't have a strong opinion about changing column names. However, if
we were to change it, I prefer to use names that
PgStat_CheckpointerStats has. BTW, that's what
PgStat_BgWriterStats/pg_stat_bgwriter and
PgStat_ArchiverStats/pg_stat_archiver uses.
typedef struct PgStat_CheckpointerStats
{
    PgStat_Counter timed_checkpoints;
    PgStat_Counter requested_checkpoints;
    PgStat_Counter checkpoint_write_time;   /* times in milliseconds */
    PgStat_Counter checkpoint_sync_time;
    PgStat_Counter buf_written_checkpoints;
    PgStat_Counter buf_written_backend;
    PgStat_Counter buf_fsync_backend;
    TimestampTz stat_reset_timestamp;
} PgStat_CheckpointerStats;

> That's a nit in any case and the patch LGTM.

Thanks.

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: "Hayato Kuroda (Fujitsu)"
Date:
Subject: RE: Perform streaming logical transactions by background workers and parallel apply
Next
From: Bharath Rupireddy
Date:
Subject: Re: O(n) tasks cause lengthy startups and checkpoints