All Posts
February 26, 20260.1.30Jugg.ai

v0.1.30 — perf: add indexes to dunningActions for pending action lookups

Release v0.1.30: Database Indexes for Dunning Performance

What changed

Added three missing indexes to the dunning_actions table:

  • idx_dunning_actions_scheduled on (scheduledAt, status) — supports billing cron queries that pick up pending actions
  • idx_dunning_actions_customer_status on (customerId, status) — supports per-customer dunning state checks
  • idx_dunning_actions_invoice on (invoiceId) — supports invoice-level action lookups

Why it matters

Without indexes, every billing cron execution performed a full sequential scan of the dunning_actions table. As dunning records accumulate, query performance degrades linearly. These three composite and single-column indexes ensure billing operations stay fast regardless of table size.

Technical notes

Indexes are applied at migration time via drizzle-kit push. No application code changes required.

Release Notes

PR #439 was reviewed and squash-merged (SHA: 03dc2c3e45f73c3458f6ae1f2c9710f4a7342ce6). The PR adds three performance-critical database indexes to the dunning_actions table in src/db/billing-schema.ts to prevent sequential scans on billing cron jobs and per-customer dunning state queries. Attempted to create the GitHub release for v0.1.30, but the tag v0.1.30 already existed in the repository — the release creation was blocked by a duplicate tag conflict. The merge itself completed successfully.