I know what PostgreSQL checkpoint is and when it is happening.
I need some additional information about the logs produced by the
log_checkpoints = on parameter, so please explain some points of it to me:
2017-09-09 16:31:37 EEST [6428-6524] LOG: checkpoint complete: wrote 30057 buffers (22.9%); 0 transaction log file(s) added, 0 removed, 47 recycled; write=148.465 s, sync=34.339 s, total=182.814 s; sync files=159, longest=16.143 s, average=0.215 s
- I know that 22.9% of shared buffers are written (I have 1024 MB
shared_buffersso that means 234 MB are written out).
- I know that 47 WAL files are recycled, i.e., they are not needed anymore for crash recovery, because the real data from them is already on disk.
Question A. But what about
write=148.465 s and
sync=34.339? What is the difference? What is
write and why its time is far more than the
Question B. What are
sync files? Which files: WAL files? Why
sync files are 159, but there are only 47 recycled files? What is the relation between these?