add checkpoint stats of snapshot and mapping files of pg_logical dir

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: add checkpoint stats of snapshot and mapping files of pg_logical dir
Date: 2021-10-29 18:53:41
Message-ID: CALj2ACXwALpiPyqj8n-LLB8J_R_s9pE3xvuGJWjVEBngG6873Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

At times, there can be many snapshot and mapping files under
pg_logical dir that the checkpoint might have to delete/fsync based on
the cutoff LSN which can increase the checkpoint time. The
user/admin/developer might want to get an answer for "what's the total
time spent in deleting these files or what's the total size of the
files deleted or what's the cutoff LSN with which these files were
deleted". How about adding these stats to existing checkpoint stats?
IMO this information will be super useful. Attaching a patch doing
that. The output looks like [1].

Thoughts?

[1]
2021-10-29 18:48:10.731 UTC [615566] LOG: checkpoint complete: wrote
449 buffers (2.7%); 0 WAL file(s) added, 0 removed, 0 recycled;
write=0.008 s, sync=0.035 s, total=0.081 s; sync files=2,
longest=0.033 s, average=0.018 s; distance=6338 kB, estimate=6338 kB;
snapbuild snapshot file(s) removed=4, size=516 bytes, time=0.001 s,
cutoff LSN=0/14C8E08; logical rewrite mapping file(s)
removed/synced=0, size=0 bytes, time=0.001 s, cutoff LSN=0/14C8E08

Regards,
Bharath Rupireddy.

Attachment Content-Type Size
v1-0001-add-checkpoint-stats-of-snapshot-and-mapping-file.patch application/octet-stream 6.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-10-29 19:45:54 Improving psql's \password command
Previous Message Robert Haas 2021-10-29 18:44:38 Re: when the startup process doesn't (logging startup delays)