Our application workload requires regular mass deletes and inserts of new data in a specific collection (based on outside factors various subsets get deleted on a daily basis and replacement data is loaded in).
We have discovered that our indexes seem to be growing in time, even when total data size and document count does not. Running a reindex() cut them down to 1/3th of the size. That difference can be a make or break in terms of performance, we could fit much more indexes into RAM.
The problem we have on Atlas is:
- when we run db.collection.reIndex() on our replica set, the reindexing happens only on the primary node
- according to docs, we should put the other servers into standalone mode to run it
- we are not able to directly connect to replica set hosts (might be our fault, but still we would need to remove them from the replica set)
Is there an operationally sustainable (automated, minimal or zero downtime) way to regularly rebuild specific indexes on all hosts in a replica set?