Skip to content

Instantly share code, notes, and snippets.

@sorentwo
Created June 12, 2026 11:31
Show Gist options
  • Select an option

  • Save sorentwo/91c898cd5635dc00de48d97bb464caa0 to your computer and use it in GitHub Desktop.

Select an option

Save sorentwo/91c898cd5635dc00de48d97bb464caa0 to your computer and use it in GitHub Desktop.
Autovacuum tuning for Oban Jobs
ALTER TABLE oban_jobs SET (
-- Vacuum earlier on large tables
autovacuum_vacuum_scale_factor = 0.02,
autovacuum_vacuum_threshold = 50,
-- Keep stats fresh for the planner
autovacuum_analyze_scale_factor = 0.02,
autovacuum_analyze_threshold = 100,
-- Make autovacuum push harder with little/no sleeping
autovacuum_vacuum_cost_limit = 2000,
autovacuum_vacuum_cost_delay = 1,
-- Handle insert-heavy spikes (PG13+)
autovacuum_vacuum_insert_scale_factor = 0.02,
autovacuum_vacuum_insert_threshold = 1000,
-- Leave headroom on pages for locality and fewer page splits
fillfactor = 85
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment