我正在尝试使用 500M 文档 (1Tb) 查询 documentDB。
var t1 = Date.now();
'Total X Records:';
db.runCommand({aggregate: "house",
pipeline: [{$project: {'_id': 1, 'foo.x': 1}},
{$match: {'foo.x.y': {$in: ['2018-12-15']}}},
{$unwind: '$foo.x'},
{$match: {'foo.x.y': {$in: ['2018-12-15']}}},
{$group: {'_id': null, 'count': {$sum: 1}}}],
cursor:{},
allowDiskUse: true,
maxTimeMS:0
});
var t2 = Date.now();
print("Time in ms: ")
print(t2-t1);
相同的查询在 mongo cluster (10 mongod) ~1hr 中运行。
当我在 DocumentDB(6 个实例 db.r4.xlarge)中运行相同的查询时,它会在 2 小时后引发错误。
{ "ok" : 0, "errmsg" : "operation was interrupted", "code" : 11601 }
Time in ms:
7226913
bye