蒙哥数据库 1.4.1
2 个集合,相同的数据,但对字段“x”使用不同的数据类型(foo - string,bar - number):
> db.foo.ensureIndex({x:1});
> db.bar.ensureIndex({x:1});
> db.foo.stats();
{
"ns" : "impressions.foo",
"count" : 50000,
"size" : 23519184,
"avgObjSize" : 470.38368,
"storageSize" : 37797888,
"numExtents" : 8,
"nindexes" : 2,
"lastExtentSize" : 15290368,
"paddingFactor" : 1,
"systemFlags" : 0,
"userFlags" : 0,
"totalIndexSize" : 2526384,
"indexSizes" : {
"_id_" : 1463504,
"x_1" : 1062880
},
"ok" : 1
}
> db.bar.stats()
{
"ns" : "impressions.bar",
"count" : 50000,
"size" : 21594256,
"avgObjSize" : 431.88512,
"storageSize" : 22507520,
"numExtents" : 7,
"nindexes" : 2,
"lastExtentSize" : 11325440,
"paddingFactor" : 1,
"systemFlags" : 0,
"userFlags" : 0,
"totalIndexSize" : 2730784,
"indexSizes" : {
"_id_" : 1463504,
"x_1" : 1267280
},
"ok" : 1
}
x_1 在情况 2 中更大,而您期望相反?