Mongodb – Best Practice for TTL index on huge dataset

deletemongodbreplicationsharding

I want to create a TTL index for a table.

  • Table size 1.2TB

I have a shard infra. Each shard is having 3 node replica set.

For creating this index, can I go with the rolling index creation method? Or any other suggestion?

Best Answer

The rolling index build procedure is recommended. Here is what they say in the doc:

To minimize the impact of building an index on replica sets and sharded clusters, use a rolling index build procedure as described on Build Indexes on Replica Sets.

for more info:

https://docs.mongodb.com/manual/tutorial/build-indexes-on-replica-sets/ https://docs.mongodb.com/manual/tutorial/build-indexes-on-sharded-clusters/ https://docs.mongodb.com/manual/core/index-ttl/ https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/#db.collection.createIndex