Checkpoints In PostgreSQL
DRANK
PostgreSQL database writes all changes happening in the database to a log file before it writes them to the actual data files. These log files are called WAL (Write-Ahead Log). Until these changes are flushed to the disk, they are kept in memory and is returned from the memory when it’s asked for. Writing to the data files directly is a costly operation for several reasons and is performed periodically. Writing to a WAL file, on the other hand, is not that expensive because the log is a sequential record of all changes, meaning records are only appended to the log and are not searched, updated, etc. While this ensures that in the event of server failure, the lost changes can be recovered from the log file. On the other hand, these log files can consume quite a lot of disk space, and re-applying the log can also become a time-consuming task if there are hundreds of log files available to re-apply before the system can achieve a consistent state.In order to reduce this time and reduce …
PostgreSQLのcheckpoint周りの話。checkpoint_completion_targetのチューニングは昔よくやってたけど、checkpoint_warningは実はあんまり使ってない。