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

From Drouvot, Bertrand
Subject Re: Introduce a new view for checkpointer related stats
Date
Msg-id 232ee920-9c05-5cac-8ccb-c14278bdff64@gmail.com
Whole thread Raw
In response to Re: Introduce a new view for checkpointer related stats  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Responses Re: Introduce a new view for checkpointer related stats
List 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@anarazel.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@anarazel.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
partof 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



pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: Re: pgsql: Revoke PUBLIC CREATE from public schema, now owned by pg_databas
Next
From: Masahiko Sawada
Date:
Subject: Re: [PoC] Improve dead tuple storage for lazy vacuum