mongodb3.4报错OperationFailed: Sort operation used more than the maximum 33554432 bytes of RAM

1.查看当数据的配置

db.adminCommand({getParameter: '*'})

默认的是32M

2.解决方案

(1).方案1

出现此种情况一般是表没有增加索引,可以通过添加索引解决,或者通过修改程序设计来解决

(2).方案2(改为64M)

特别注意:不建议修改默认配置,会导致sort的时候占用更多的内存,进而导致占用内存过大而oom

临时生效:

mongoDB3.4 :​​db.adminCommand({"setParameter":1,"internalQueryExecMaxBlockingSortBytes":67108864})​

mongoDB4.4 :​​db.adminCommand({"setParameter":1,"internalQueryMaxBlockingSortMemoryUsageBytes":67108864})​

长期生效:

mongoDB3.4

setParameter:
internalQueryExecMaxBlockingSortBytes: 67108864

mongodb3.4报错OperationFailed: Sort operation used more than the maximum 33554432 bytes of RAM

mongoDB4.4

setParameter:
internalQueryMaxBlockingSortMemoryUsageBytes: 67108864

mongodb3.4报错OperationFailed: Sort operation used more than the maximum 33554432 bytes of RAM