Re: Introduce a new view for checkpointer related stats

From: "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Introduce a new view for checkpointer related stats
Date: 2022-11-22 07:55:58
Message-ID: 5add14c3-f9b1-c368-b6d8-a14c051b3373@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 11/17/22 1:51 PM, Bharath Rupireddy wrote:
> Hi,
>
> pg_stat_bgwriter view currently reports checkpointer stats as well. It
> is that way because historically checkpointer was part of bgwriter
> until the commits 806a2ae and bf405ba, that went into PG 9.2,
> separated them out. I think it is time for us to separate checkpointer
> stats to its own view. I discussed it in another thread [1] and it
> seems like there's an unequivocal agreement for the proposal.
>
> I'm attaching a patch introducing a new pg_stat_checkpointer view,
> with this change the pg_stat_bgwriter view only focuses on bgwriter
> related stats. The patch does mostly mechanical changes. I'll add it
> to CF in a bit.
>
> Thoughts?

+1 for the dedicated view.

+ <para>
+ The <structname>pg_stat_checkpointer</structname> view will always have a
+ single row, containing global data for the cluster.
+ </para>

what about "containing data about checkpointer activity of the cluster"? (to provide more "details" (even if that seems obvious given the name of the view) and be consistent with the pg_stat_wal description too).
And if it makes sense to you, While at it, why not go for "containing data about bgwriter activity of the cluster" for pg_stat_bgwriter too?

+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 don't think we should keep the checkpoints_ prefix (or _checkpoint suffix) in the column names now that they belong to a dedicated view (also the pg_stat_bgwriter view's columns don't have a
bgwriter prefix/suffix).

And while at it, I'm not sure the wal_ suffix in pg_stat_wal make sense too.

The idea is to have consistent naming between the views and their columns: I'd vote without prefix/suffix.

Regards,

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message walther 2022-11-22 08:02:15 Re: fixing CREATEROLE
Previous Message Richard Guo 2022-11-22 07:44:57 Re: Bug in row_number() optimization