# 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.

Category: Performance and cost
Source: https://letsship.ai/use-cases/narrow-a-scheduled-job
Published: 2026-08-25

## Goal

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.

## Prompt

Copy this to an agent to open the ticket:

```text
Create a Linear issue in my team and assign it to the SHIP agent.

Title: Narrow the {job} scheduled job

Description: 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

Before you create the issue, find the longest-running scheduled job in this repository and replace {job} with it.
```

## 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.
