溢出排序阶段缓冲的数据使用量超出内部限制 [英] Overflow sort stage buffered data usage exceeds internal limit

查看:52
本文介绍了溢出排序阶段缓冲的数据使用量超出内部限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用代码:

all_reviews = db_handle.find().sort('reviewDate', pymongo.ASCENDING)
print all_reviews.count()

print all_reviews[0]
print all_reviews[2000000]

计数打印为2043484,打印为all_reviews[0].

但是在打印all_reviews[2000000]时,出现错误:

However when printing all_reviews[2000000], I get the error:

pymongo.errors.OperationFailure:数据库错误:Runner错误:溢出排序阶段缓冲的33554495字节的数据使用量超过了33554432字节的内部限制

pymongo.errors.OperationFailure: database error: Runner error: Overflow sort stage buffered data usage of 33554495 bytes exceeds internal limit of 33554432 bytes

我该如何处理?

推荐答案

对于内存排序,您遇到了32MB的限制:

You're running into the 32MB limit on an in-memory sort:

https://docs.mongodb.com/manual/reference/limits /#排序操作

将索引添加到排序字段.这样一来,MongoDB可以按排序顺序将文档流式传输给您,而不是尝试将它们全部加载到服务器上的内存中并在将它们发送到客户端之前对它们进行内存排序.

Add an index to the sort field. That allows MongoDB to stream documents to you in sorted order, rather than attempting to load them all into memory on the server and sort them in memory before sending them to the client.

这篇关于溢出排序阶段缓冲的数据使用量超出内部限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆