Re: Re: Postgres Parameters - Mailing list pgsql-admin
| From | Sam Stearns |
|---|---|
| Subject | Re: Re: Postgres Parameters |
| Date | |
| Msg-id | CAN6TVjndnx18mPT2aU4c+rG1X=vLb8eZF5WAF4dXGOTHrgB1Gg@mail.gmail.com Whole thread Raw |
| In response to | Re: Re: Postgres Parameters ("zhenwei.li@sfere-elec.com" <zhenwei.li@sfere-elec.com>) |
| List | pgsql-admin |
Thank you, Zhenwei.
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,ZjQcmQRYFpfptBannerStartThis Message Is From an Untrusted SenderYou have not previously corresponded with this sender.ZjQcmQRYFpfptBannerEndI found that PostgreSQL 15.3 doesn't support thepg_stat_checkpointerview. We can usepg_stat_bgwriterinstead. 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;Awesome stuff. Thank you, everyone!SamOn Tue, Nov 11, 2025 at 3:19 AM Fabrice Chapuis <fabrice636861@gmail.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,ZjQcmQRYFpfptBannerStartThis Message Is From an Untrusted SenderYou have not previously corresponded with this sender.ZjQcmQRYFpfptBannerEndHi,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.SELECTnum_timed,num_requested,round((num_requested::numeric / NULLIF(num_timed + num_requested, 0)) * 100, 2)AS requested_pctFROM pg_stat_checkpointer;+-----------+---------------+---------------+| num_timed | num_requested | requested_pct |+-----------+---------------+---------------+| 3502 | 146 | 4.00 |+-----------+---------------+---------------+(1 row)Regards,FabriceOn Tue, Nov 11, 2025 at 12:28 AM Sam Stearns <sam.stearns@dat.com> wrote:--
pgsql-admin by date: