Hi there,
We have a Percona MongoDB v3.6.17-4.0, runnion on Debian. One of our backends has been adding too much data, then size is 100GB, growing about 5GB every 2-3 weeks. We realized we have a bunch of documents we could delete, of the 85 MM, perhaps 1/4 of the documents can be gone, for good.
I am doing a few steps:
- Add a compound index to use on the deleteMany.
- Run the 1st deleteMany that use the compound index of 2 fields.
- Run another deleteMany that use a current/existing index.
- Compact the collection.
It takes a long time, like 20 hours in our ESXi servers. I was wondering how I can improve it? We have add more RAM to the VM, 64GB of RAM, and I am assigning 48GB to cacheSizeGB, we use the wiredTiger engine, with the journal set to false, and checkpointSizeMB set to 500.
The original database runs on a ReplicaSet, but I have setup this node as standalone, I guess I might have better results single node, for this particular task.
I was wondering, what else, I can do? add more RAM?
The collection I am refering has already many index, like 45-50 indexes, then another tests I am thinking is:
- drop all the indexes
- add the 2 or 3 index I need for this specific task
- Run the 1st deleteMany that use the compound index of 2 fields.
- Run another deleteMany that use a current
- Compact the collection.
- Add all the rest of the indexes we have, and our backends utilizes.
Help me, Obi Wan Kenobi, you’re my only hope.