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>, Andres Freund <andres(at)anarazel(dot)de>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Introduce a new view for checkpointer related stats
Date: 2022-11-30 07:13:14
Message-ID: 232ee920-9c05-5cac-8ccb-c14278bdff64@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 11/30/22 7:34 AM, Bharath Rupireddy wrote:
> On Wed, Nov 30, 2022 at 6:01 AM Andres Freund <andres(at)anarazel(dot)de> wrote:
>>
>> Hi,
>>
>> On 2022-11-28 12:58:48 -0500, Robert Haas wrote:
>>> On Tue, Nov 22, 2022 at 3:53 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
>>>> 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.
>>>
>>> I vote to just remove them. I think that most people won't update
>>> their queries until they are forced to do so.
>>
>> Seems most agree with that... WFM.
>
> Thanks. I'm attaching the v2 patch from upthread again here as we all
> agree to remove checkpointer columns from pg_stat_bgwriter view and
> have them in the new view pg_stat_checkpointer.
>

+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 were part 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;
+

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

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 Masahiko Sawada 2022-11-30 07:27:59 Re: [PoC] Improve dead tuple storage for lazy vacuum
Previous Message Noah Misch 2022-11-30 07:07:01 Re: pgsql: Revoke PUBLIC CREATE from public schema, now owned by pg_databas