Skip to content

feat(table): add configurable autovacuum settings for outbox tables - #30

Merged
OpenSourceAlchemist merged 2 commits into
mainfrom
feat/autovacuum
Sep 6, 2026
Merged

feat(table): add configurable autovacuum settings for outbox tables#30
OpenSourceAlchemist merged 2 commits into
mainfrom
feat/autovacuum

Conversation

@OpenSourceAlchemist

Copy link
Copy Markdown
Member

Description

Add configurable autovacuum settings to outbox tables via ALTER TABLE SET (...).

Outbox tables have high churn as events are inserted and then processed/deleted.
Default PostgreSQL autovacuum settings (scale_factor=0.2) can lead to table bloat
and performance degradation.

Changes

  • Apply autovacuum settings on table creation (on by default)
  • All 5 thresholds are configurable via options
  • Opt-out with autovacuum: false
  • Add --no-autovacuum CLI flag to outboxify

API

DB.pgt_outbox_setup(:accounts,
  autovacuum: true,                              # default: on
  autovacuum_vacuum_scale_factor: 0,             # default
  autovacuum_vacuum_threshold: 50,               # default
  autovacuum_analyze_scale_factor: 0,            # default
  autovacuum_analyze_threshold: 50,              # default
  autovacuum_vacuum_cost_delay: 0                # default
)

Closes #29

- Add ALTER TABLE SET (autovacuum_...) by default after table creation
- Default values: vacuum_scale_factor=0, vacuum_threshold=50,
  analyze_scale_factor=0, analyze_threshold=50, vacuum_cost_delay=0
- All thresholds are configurable via options
- Opt-out with autovacuum: false
- Add --no-autovacuum CLI flag to outboxify
- Add tests verifying default, disabled, and custom settings

@bougyman bougyman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks solid. Make it sew

@OpenSourceAlchemist
OpenSourceAlchemist merged commit 2e458b4 into main Sep 6, 2026
7 checks passed
@OpenSourceAlchemist
OpenSourceAlchemist deleted the feat/autovacuum branch September 6, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add autovac adjustement to outbox tables

2 participants