生產環境mongodb 報錯,
sort operation used more than the maximum 33554432 bytes of RAM. Add an index,or specify a smaller limit
排序查詢超過最大內存32兆,添加索引或者增加內存限制
解決方法
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})