Narrow a scheduled job that scans more than it needs
A job that scans the whole table every run, narrowed to the rows that actually changed.
The ticket
Narrow a scheduled job so it processes only the records that need it.
Acceptance criteria
- The job processes only changed or eligible records
- A test proves the narrowed scope still catches everything it should
- Runtime and rows scanned are recorded before and after
- A full run remains available for recovery
What lands as proof
A correctness test on the narrowed scope, alongside the runtime saving. The saving alone is not enough.
Why teams defer it
- It runs at night, so nobody feels the cost until it stops finishing before morning.
- Narrowing the scope risks missing records, which is a correctness argument rather than a performance one.
Questions
- What does the agent actually change?
- The ticket is scoped to one outcome: narrow a scheduled job so it processes only the records that need it. Work that serves that outcome is in scope, and anything outside it is left for a separate ticket, so the pull request stays reviewable.
- How do I know the work is done?
- The pull request carries the evidence, not only the diff. Here that means timing plus a correctness test on the narrowed scope, so a reviewer can confirm the result without reproducing the work locally.
- How much oversight does this need?
- The run stops once the plan is written. Somebody reads the approach and approves it before any code exists, which is the cheapest moment to redirect the work.