I create an index ({a: 1, b: -1}), one of the foregrounds and others doing in the background. Check the total size of the index. Foreground: 82536720 Background: 154927024
Can someone tell me why there is a huge size difference?
Mongo > db.testing.ensureIndex({a:1,b:-1}) Mongo > db.testing.stats() { "ns" : "test.testing", "count" : 2402158, "size" : 86479836, "avgObjSize" : 36.00089419596879, "totalIndexSize" : 160486704, "indexSizes" : { "_id_" : 77949984, "a_1_b_-1" : 82536720 }, } Mongo > db.testing.dropIndexes() Mongo > db.testing.ensureIndex({a:1,b:-1},{background : true}) Mongo > db.testing.stats() { "count" : 2402158, "size" : 86479836, "avgObjSize" : 36.00089419596879, "totalIndexSize" : 232877008, "indexSizes" : { "_id_" : 77949984, "a_1_b_-1" : 154927024 }, }
source share