| From: | Sam Stearns <sam(dot)stearns(at)dat(dot)com> |
|---|---|
| To: | "zhenwei(dot)li(at)sfere-elec(dot)com" <zhenwei(dot)li(at)sfere-elec(dot)com> |
| Cc: | Fabrice Chapuis <fabrice636861(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Ron Johnson <ronljohnsonjr(at)gmail(dot)com>, Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>, Henry Ashu <henry(dot)ashu(at)dat(dot)com> |
| Subject: | Re: Re: Postgres Parameters |
| Date: | 2025-11-12 15:12:16 |
| Message-ID: | CAN6TVjndnx18mPT2aU4c+rG1X=vLb8eZF5WAF4dXGOTHrgB1Gg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-admin |
Thank you, Zhenwei.
On Tue, Nov 11, 2025 at 6:26 PM zhenwei(dot)li(at)sfere-elec(dot)com <
zhenwei(dot)li(at)sfere-elec(dot)com> wrote:
> I found that PostgreSQL 15. 3 doesn't support the pg_stat_checkpointer
> view. We can use pg_stat_bgwriter instead. The SQL is as follows: SELECT
> checkpoints_timed AS num_timed, -- Checkpoints triggered by timeout
> checkpoints_req AS num_requested,
> ZjQcmQRYFpfptBannerStart
> This Message Is From an Untrusted Sender
> You have not previously corresponded with this sender.
>
> ZjQcmQRYFpfptBannerEnd
> I found that PostgreSQL 15.3 doesn't support the pg_stat_checkpointer
> view. We can use pg_stat_bgwriter instead. The SQL is as follows:
>
> SELECT
> checkpoints_timed AS num_timed, -- Checkpoints triggered by timeout
> checkpoints_req AS num_requested, -- Checkpoints triggered by requests (like when WAL space is tight)
> round(
> (checkpoints_req::numeric / NULLIF(checkpoints_timed + checkpoints_req, 0)) * 100,
> 2
> ) AS requested_pct -- % of checkpoints that were request-triggered
> FROM pg_stat_bgwriter;
>
>
>
> *From:* Sam Stearns <sam(dot)stearns(at)dat(dot)com>
> *Date:* 2025-11-11 23:24
> *To:* Fabrice Chapuis <fabrice636861(at)gmail(dot)com>; Laurenz Albe
> <laurenz(dot)albe(at)cybertec(dot)at>; Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
> *CC:* Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>; Henry Ashu
> <henry(dot)ashu(at)dat(dot)com>
> *Subject:* Re: Postgres Parameters
> Awesome stuff. Thank you, everyone!
>
> Sam
>
>
> On Tue, Nov 11, 2025 at 3:19 AM Fabrice Chapuis <fabrice636861(at)gmail(dot)com>
> wrote:
>
>> Hi, You could also use this query, if the ratio is low, that means there
>> is no pressure on wal size and you can keep the max_wal_size value as it
>> is. SELECT num_timed, num_requested, round((num_requested: : numeric /
>> NULLIF(num_timed + num_requested,
>> ZjQcmQRYFpfptBannerStart
>> This Message Is From an Untrusted Sender
>> You have not previously corresponded with this sender.
>>
>> ZjQcmQRYFpfptBannerEnd
>> Hi,
>>
>> You could also use this query, if the ratio is low, that means there is
>> no pressure on wal size and you can keep the max_wal_size value as it is.
>>
>> SELECT
>> num_timed,
>> num_requested,
>> round((num_requested::numeric / NULLIF(num_timed + num_requested, 0)) *
>> 100, 2)
>> AS requested_pct
>> FROM pg_stat_checkpointer;
>> +-----------+---------------+---------------+
>> | num_timed | num_requested | requested_pct |
>> +-----------+---------------+---------------+
>> | 3502 | 146 | 4.00 |
>> +-----------+---------------+---------------+
>> (1 row)
>>
>> Regards,
>>
>> Fabrice
>>
>>
>> On Tue, Nov 11, 2025 at 12:28 AM Sam Stearns <sam(dot)stearns(at)dat(dot)com> wrote:
>>
>>> Howdy,
>>>
>>> Could someone advise on how to determine the correct settings for the
>>> following, please?:
>>>
>>>
>>> - checkpoint_timeout
>>> - max_wal_size
>>>
>>>
>>> Thank you,
>>>
>>> Sam
>>>
>>> --
>>>
>>> Samuel Stearns
>>> Team Lead - Database
>>> c: 971 762 6879 | o: 971 762 6879 | DAT.com
>>>
>>>
>>> <https://www.dat.com/?utm_medium=email&utm_source=DAT_email_signature_link>
>>>
>>>
>
> --
>
> Samuel Stearns
> Team Lead - Database
> c: 971 762 6879 | o: 971 762 6879 | DAT.com
>
> <https://www.dat.com/?utm_medium=email&utm_source=DAT_email_signature_link>
>
>
--
Samuel Stearns
Team Lead - Database
c: 971 762 6879 | o: 971 762 6879 | DAT.com
<https://www.dat.com/?utm_medium=email&utm_source=DAT_email_signature_link>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Joseph Craig | 2025-11-12 15:20:16 | Postgres HA Deployment Questions |
| Previous Message | Ron Johnson | 2025-11-12 14:06:41 | Re: Monitoring PostgreSQL Copy Operations |