Re: Inconsistency in reporting checkpointer stats

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Nitin Jadhav <nitinjadhavpostgres(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, vignesh C <vignesh21(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Inconsistency in reporting checkpointer stats
Date: 2024-09-30 18:33:30
Message-ID: 68c00653-9f21-42d4-9a0f-617fd92254a9@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2024/09/22 20:44, Nitin Jadhav wrote:
>> + CheckpointStats.ckpt_slru_written,
>> + (double) CheckpointStats.ckpt_slru_written * 100 / NBuffers,
>>
>> I don't think NBuffers represents the maximum number of SLRU buffers.
>> We might need to calculate this based on specific GUC settings,
>> like transaction_buffers.
>
> Great observation. Since the SLRU buffers written during a checkpoint
> can include transaction_buffers, commit_timestamp_buffers,
> subtransaction_buffers, multixact_member_buffers,
> multixact_offset_buffers, and serializable_buffers, the total count of
> SLRU buffers should be the sum of all these types. We might need to
> introduce a global variable, such as total_slru_count, in the
> globals.c file to hold this sum. The num_slots variable in the
> SlruSharedData structure needs to be accessed from all types of SLRU
> and stored in total_slru_count. This can then be used during logging
> to calculate the percentage of SLRU buffers written. However, I’m
> unsure if this effort is justified. While it makes sense for normal
> buffers to display the percentage, the additional code required might
> not provide significant value to users. Therefore, I have removed this
> in the attached v6 patch.

+1

Thanks for updating the patch! It looks good to me.
Barring any objections, I will commit this patch.

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michał Kłeczek 2024-09-30 18:36:26 Re: SET or STRICT modifiers on function affect planner row estimates
Previous Message Jim Jones 2024-09-30 18:16:09 Re: Psql meta-command conninfo+