preloader
軟體工程

Postgres WAL 概述

PostgreSQL version 10 WAL 設定概述

參數:

  1. checkpoint_timeout default is 5 minute

  2. max_wal_size default is 1GB

  3. archive_timeout

  4. full_page_writes

  5. checkpoint_warning

  6. checkpoint_completion_target default is 0.5 and only be fraction of checkpoint_timeout

  7. pg_test_fsync can measure average speed in microsecond of single WAL flush operation. Half of its value is effective for reporting average time setting that it flush single 8KB write operation to commit_delay. pg_test_fsync doesn’t care whether fsync is turned off or not. Also its value is used to a start point for optimizing a particular workload.

  8. wal_debug will enforce to write XLOGFLUSH and XLOGINSERTRECORD-related log into server log.

  9. commit_delay it purposes to amortize cost across concurrently commiting transactions. The higher the value, the more effective it’s expected to increasing throughput, to a point. Tuning commit_delay is useful when WAL log is stored in high-rotational latency disk and even more effective to ssd or other RAID array with battery-back write cache. Higher value of commit_siblings can be used to such cases. Oftenly, commit_siblings use smaller value in high latency media. Remark: It’s quitely suffering when commit_delay being set too high.

  10. max_wal_size Due to short-term peak of log output rate, if it exceeds max_wal_size, the unneeded segment files will be removed until the system get back under the limit. When belowing the limit, the system recycle segment files for future estimated usage before next checkpoint and then the rest are removed.

  11. min_wal_size

 

Reference: https://www.postgresql.org/docs/current/static/wal-configuration.html