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.
v1-0001-add-checkpoint-stats-of-snapshot-and-mapping-file.patch
Description: Binary data