dataiotech Labs
dbaguidedbaguideDBAdataxtoolsdataopsphere
Home/Glossary/Index Build & Lock
Index Build & LockSharding & High Availability

Index Build Performance & Rolling Index Deployment

The operational methodology and locking behavior surrounding index construction on large collections to prevent blocking exclusive table locks and replication stalls.

Internal Architecture Breakdown

Legacy MongoDB versions blocked all database writes during foreground index generation. MongoDB 4.2+ builds indexes concurrently with writes, yielding locks during phase boundaries.

However, building indexes on massive multi-terabyte collections still creates heavy CPU/disk contention. Production SREs employ rolling index builds: provisioning indexes on isolated secondary nodes sequentially before orchestrating a clean primary step-down.

Production Inspection Queries

MongoDB
db.currentOp({ 'op': 'command', 'query.createIndexes': { $exists: true } });