Assuming our logs are located at /db/pgdata/pg_log, follow these steps to examine the checkpoint activity:
- Execute this command to find the most recent logfile:
ls -lt /db/pgdata/pg_log/postgres*.log | head -n 1
- If the latest log is named postgresql-2016-10-16.log, view all the checkpoints in this log with the following command:
grep checkpoint /db/pgdata/pg_log/postgresql-2016-10-16.log
- Execute the following command to obtain the five longest disk syncs:
grep 'checkpoint complete:' \ /db/pgdata/pg_log/postgresql-2016-10-16.log \ | sed 's/.* sync=/sync=/; s/total=.*; //;' \ | sort -n | tail -n 5