Assumming we have 3 columns which are relevant for partion : key1 , key2 and lastupdateddate.
when we delete a lot of records from collection (~billion of records) , the index {key1:1,key2:1,lastupdateddate:1} is rebuilding constantly and consumes huge amount of cpu and disk.
We are considering to partition the index. , e.g create
{key1: 1, key2: 1 }, { partialFilterExpression: { lastupdateddate: { $lte: new Date("2024-07-01T00:00:00Z")$gt: new Date("2024-06-01T00:00:00Z") } } }
{key1: 1, key2: 1 }, { partialFilterExpression: { lastupdateddate: { $lte: new Date("2024-06-01T00:00:00Z")$gt: new Date("2024-05-01T00:00:00Z") } } }
and so on.
Would this partial indexes be sufficient to query for the data based on key1 and key2?