From 4f62b280c5e3ce26ffcba684d44cd699ccb04790 Mon Sep 17 00:00:00 2001 From: sneak Date: Thu, 1 Jan 2026 06:48:58 -0800 Subject: [PATCH] Reduce WAL checkpoint interval from 30s to 5s Under heavy write load, 30 seconds is too long between checkpoints, causing the WAL to grow and slow down read queries. More aggressive checkpointing keeps the WAL small and maintains read performance. --- internal/routewatch/dbmaintainer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/routewatch/dbmaintainer.go b/internal/routewatch/dbmaintainer.go index 653301f..993d616 100644 --- a/internal/routewatch/dbmaintainer.go +++ b/internal/routewatch/dbmaintainer.go @@ -14,7 +14,8 @@ import ( const ( // checkpointInterval is how often to run WAL checkpoint. // Frequent checkpoints keep the WAL small, improving read performance. - checkpointInterval = 30 * time.Second + // Under heavy write load, we need aggressive checkpointing. + checkpointInterval = 5 * time.Second // vacuumInterval is how often to run incremental vacuum. // Since incremental vacuum only frees ~1000 pages (~4MB) per run,