Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit.

bug问题 · wizren · 于 2年前 发布 · 871 次阅读

刚把mysql切换成mongodb,后台只设置了分类和产品数据存储引擎为mongodb,其他的未改动。商品分类下点击最后一页直接报错。以下是报错信息:

Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit.

加索引的话需要加哪些字段做索引

共收到 2 条回复 问题提问
Fecmall#12年前 0 个赞

内存不足吧?

原因比较明确:Sort operation used more than the maximum 33554432 bytes of RAM.,33554432 bytes算下来正好是32Mb,而Mongodb的sort操作是把数据拿到内存中再进行排序的,为了节约内存,默认给sort操作限制了最大内存为32Mb,当数据量越来越大直到超过32Mb的时候就自然抛出异常了!

类似问题多百度。

wizren#22年前 0 个赞

@Fecmall #1楼 这个我查过,增加内存是一方面,是否需要给对应字段增加索引呢?加索引会快一些吧。如果需要的话是哪些字段要加

添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics