diff --git a/internal/database/database.go b/internal/database/database.go index 8e20ce1..aac7744 100644 --- a/internal/database/database.go +++ b/internal/database/database.go @@ -2000,9 +2000,10 @@ func (d *Database) Analyze(ctx context.Context) error { } // Checkpoint runs a WAL checkpoint to transfer data from the WAL to the main database. -// Uses PASSIVE mode which doesn't block writers but may not checkpoint all frames. +// Uses TRUNCATE mode which blocks writers briefly but ensures complete checkpoint, +// keeping the WAL small for fast read performance. func (d *Database) Checkpoint(ctx context.Context) error { - _, err := d.db.ExecContext(ctx, "PRAGMA wal_checkpoint(PASSIVE)") + _, err := d.db.ExecContext(ctx, "PRAGMA wal_checkpoint(TRUNCATE)") if err != nil { return fmt.Errorf("failed to checkpoint WAL: %w", err) }