Re: Introduce a new view for checkpointer related stats

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

Hi,

On 2022-11-22 18:08:28 +0530, Bharath Rupireddy wrote:
> diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql
> index 2d8104b090..131d949dfb 100644
> --- a/src/backend/catalog/system_views.sql
> +++ b/src/backend/catalog/system_views.sql
> @@ -1105,18 +1105,22 @@ CREATE VIEW pg_stat_archiver AS
>
> CREATE VIEW pg_stat_bgwriter AS
> SELECT
> - pg_stat_get_bgwriter_timed_checkpoints() AS checkpoints_timed,
> - pg_stat_get_bgwriter_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_bgwriter_buf_written_checkpoints() AS buffers_checkpoint,
> pg_stat_get_bgwriter_buf_written_clean() AS buffers_clean,
> pg_stat_get_bgwriter_maxwritten_clean() AS maxwritten_clean,
> - pg_stat_get_buf_written_backend() AS buffers_backend,
> - pg_stat_get_buf_fsync_backend() AS buffers_backend_fsync,
> pg_stat_get_buf_alloc() AS buffers_alloc,
> pg_stat_get_bgwriter_stat_reset_time() AS stats_reset;
>
> +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 think we should consider deprecating the pg_stat_bgwriter columns but
leaving them in place for a few years. New stuff should only be added to
pg_stat_checkpointer, but we don't need to break old monitoring queries.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michail Nikolaev 2022-11-22 21:53:33 Re: Slow standby snapshot
Previous Message Stavros Koureas 2022-11-22 20:10:15 Re: Logical Replication Custom Column Expression