Skip to content

DB Size Management

o51r15 edited this page Jul 11, 2026 · 1 revision

DB Size Management

The db_trim worker purges old and dead torrents based on configurable per-source rules. It runs as a background service on a 24-hour cycle. Disabled by default — must be explicitly enabled.


Configuration

Add to config.yml:

db_trim:
  enabled: true
  dry_run: false                     # start with true to preview what would be removed
  protect_prowlarr_sources: true     # never trim if a Prowlarr source exists
  sources:
    - source: dht
      max_age_days: 180              # trim DHT torrents older than 6 months...
      min_seeds: 1                   # ...that have fewer than 1 seeder
      ignore_no_seed_data: true      # don't trim if seed count is unknown
    - source: default
      max_age_days: -1               # -1 = disabled
      min_seeds: -1
      ignore_no_seed_data: true

Add --keys=db_trim to your compose command block. See Worker Keys.


How trim rules work

  • AND logic: Both max_age_days AND min_seeds must be satisfied for a torrent to be trimmed
  • -1 = disabled: Setting either value to -1 disables that dimension of the check
  • Per-source rules: Each source (dht, prowlarr-20, default) can have independent rules
  • Default source: The default rule applies to any source not explicitly configured

Prowlarr protection

When protect_prowlarr_sources: true (the default), any torrent that also exists in a Prowlarr source is exempt from trimming — regardless of other sources' rules. This preserves the key value of Prowlarr integration: content stays searchable even when the original indexer goes offline.


Dry run

Set dry_run: true to preview what would be removed without actually deleting anything. Check the logs to see which torrents would be trimmed, then switch to dry_run: false when satisfied.


Example configurations

Aggressive DHT trim, keep Prowlarr forever:

db_trim:
  enabled: true
  protect_prowlarr_sources: true
  sources:
    - source: dht
      max_age_days: 90
      min_seeds: 0
      ignore_no_seed_data: false

Hoarder mode (keep everything, trim only confirmed-dead):

db_trim:
  enabled: true
  sources:
    - source: dht
      max_age_days: 365
      min_seeds: 0
      ignore_no_seed_data: true

Disabled (default — keep everything): Don't add --keys=db_trim to your compose, or set enabled: false.


Technical details

  • Processes 1,000 rows per batch to avoid large transactions
  • After deleting source links, torrents with no remaining source links are automatically deleted (FK CASCADE handles related tables)
  • Runs once immediately on startup, then every 24 hours
  • Worker logs rows removed per source per run

Clone this wiki locally