# Index builds

Symptom: writes are slow or a deploy is stuck; you suspect an index build.

## Diagnose

Check currentOp for an in-progress index build and its progress. Atlas shows build state in the UI as well. Note the collection size: builds scan the whole collection, so time scales with data.

## Confirm

If the build is foreground-equivalent on the primary, writes to that collection queue behind it. On dedicated clusters you can use a rolling build (build on secondaries first, then step down the primary) to avoid the write stall.

## Fix

- Let a healthy build finish; killing and restarting it wastes the work.
- For future big builds: schedule during low traffic, or use the rolling build procedure on dedicated tiers.
- In application code, never build production indexes from app startup (`autoIndex: false` in Mongoose); manage them as deliberate operations.

## Verify

The build completes, the index appears in the index list, and a previously slow query shape now uses it (confirm with explain).