【mongodb|mongodb分页排序获取数据 导致超出32M限制】转自
mongodb 分页排序获取数据导致超出32M限制:Sort operation used more than the maximum 33554432 bytes of RAM
异常:
"exception":"org.springframework.data.mongodb.UncategorizedMongoDbException",
"message":"Query failed with error code 96 and error message 'Executor error during find command: OperationFailed: Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit.' on server 127.0.0.1:27017;
nested exception is com.mongodb.MongoQueryException:
Query failed with error code 96 and error message 'Executor error during find command: OperationFailed: Sort operation used more than the maximum 33554432 bytes of RAM.
Add an index, or specify a smaller limit.' on server 127.0.0.1:27017"
处理方式:
- 加索引
db.yourCollection.createIndex({:<1 or -1>})
- 扩大排序内存的限制,例如扩大到320M
db.adminCommand({setParameter:1, internalQueryExecMaxBlockingSortBytes:335544320})
如果你已经加了索引了还是报32M,那么目前只能扩大内存了。
推荐阅读
- 数据库|SQL行转列方式优化查询性能实践
- mysql|一文深入理解mysql
- 达梦数据库|DM8表空间备份恢复
- 数据技术|一文了解Gauss数据库(开发历程、OLTP&OLAP特点、行式&列式存储,及与Oracle和AWS对比)
- SqlServer|sql server的UPDLOCK、HOLDLOCK试验
- 谈灾难恢复指标(RTO与RPO是什么鬼())
- RPO与RTO
- 2018|2018,倒数80天 《AI》