生产环境mongodb 报错,
sort operation used more than the maximum 33554432 bytes of RAM. Add an index,or specify a smaller limit

mongodb 版本 3.2.6,下面是官方文档的描述

Sort Operations
If MongoDB cannot use an index to get documents in the requested sort order, the combined size of all documents in the sort operation, plus a small overhead, must be less than 32 megabytes.

解决方法
1、创建索引

--不阻塞创建索引
db.xxxxx.createIndex({"name":1,"sex":1},{"background":1})

2、增加sort memory

--查询当前值
db.runCommand({ getParameter : 1, "internalQueryExecMaxBlockingSortBytes" : 1 } )

--设置新值
db.adminCommand({setParameter:1, internalQueryExecMaxBlockingSortBytes:67108864})

相关文章:

  • 2021-07-20
  • 2022-12-23
  • 2022-12-23
  • 2021-07-24
  • 2022-12-23
  • 2022-12-23
  • 2021-10-27
猜你喜欢
  • 2021-06-29
  • 2021-12-30
  • 2022-02-26
  • 2022-12-23
  • 2022-12-23
  • 2021-10-19
相关资源
相似解决方案