MongoDB Sort op eration used more than the maximum 33554432 bytes of RAM. Add an index, or speci fy a smaller limit.
最近在获取mongodb某个集合的数据过程中,在进行排序的过程中报错,具体报错信息如下:
Error: error: {
"ok" : ,
"errmsg" : "Executor error during find command: OperationFailed: Sort op
eration used more than the maximum bytes of RAM. Add an index, or speci
fy a smaller limit.",
"code" : ,
"codeName" : "OperationFailed"
}
知道这是排序的时候报的错,因为 mongo 的 sort 操作是在内存中操作的,必然会占据内存,同时mongo 内的一个机制限制排序时最大内存为 32M,当排序的数据量超过 32M,就会报上面的这个错,
解决办法就像上面提示的意思,一是加大 mongo 的排序内存,这个一般是运维来管,也有弊端,就是数据量如果再大,还要往上加。另一个办法就是加索引。
创建索引
db.你的collection.createIndex({"你的字段": -1}),此处 -1 代表倒序,1 代表正序;
比如对trsdata集合的IR_URLTIME字段建立索引:db.trsdata.createIndex({"IR_URLTIME": -1})
查询索引: db.trsdata.getIndexes()
这样建立索引后就可以进行排序了。
MongoDB Sort op eration used more than the maximum 33554432 bytes of RAM. Add an index, or speci fy a smaller limit.的更多相关文章
- Mongodb: Sort operation used more than the maximum 33554432 bytes of RAM
上线许久的产品突然爆出了一个Mongodb 查询的BUG,错误如下: "exception":"org.springframework.data.mongodb.Unca ...
- Overflow sort stage buffered data usage of 33554495 bytes exceeds internal limit of 33554432 bytes
MongoDB执行错误: Overflow sort stage buffered data usage of 33554495 bytes exceeds internal limit of 335 ...
- mongodb sort limit和skip用法
> db.mediaCollection.find().skip().toArray() [ { "_id" : ObjectId("5353463193efef0 ...
- mongodb sort
sort() 方法 要在 MongoDB 中的文档进行排序,需要使用sort()方法. sort() 方法接受一个文档,其中包含的字段列表连同他们的排序顺序.要指定排序顺序1和-1. 1用于升序排列, ...
- mongodb Sort排序能够支持的最大内存限制为32M Plan executor error during find: FAILURE
1.一个比较老的游戏服维护,关服维护后启动时报错 2.看到关于mongodb的报错,于是去查一下mongodb的日志 Plan executor error during find: FAILURE, ...
- MongoDB排序异常
com.mongodb.MongoQueryException: Query failed with error code 96 and error message 'Executor error d ...
- Mongodb——文档数据库
mongodb是一个文档数据库. mongo操作 多个修改操作,但每个修改携带的数据包较小,可操作考虑批量操作.bulkWrite()改善性能. MongoCollection是线程安全的. db.c ...
- mongodb报错一例
开发程序报错信息: Caused by: com.mongodb.MongoException: Executor error: OperationFailed: Sort operation use ...
- 一个MongoDB索引走偏的案例及探究分析
接业务需求,有一个MongoDB的简单查询,太耗时了,执行了 70S 左右,严重影响用户的体验.. 查询代码主要如下: db.duoduologmodel.find({"Tags.SN&qu ...
随机推荐
- python opencv3 轮廓检测
git:https://github.com/linyi0604/Computer-Vision # coding:utf8 import cv2 import numpy as np # 创建一个2 ...
- 2 Scala基本语法
1 变量和函数 变量: Scala 有两种变量, val 和 var. val:常量,类似于 Java 里的 final 变量.一旦初始化了, val 就不能再赋值了. va: 如同 Java 里面的 ...
- hdu 2266 dfs
题意:在数字之间添加运算符号,使得结果等于题目中要求的Sample Input123456789 321 1Sample Output181 这题虽然看起来比较简单,但是之前和差的状态不太好表示,因此 ...
- poj 1330 Nearest Common Ancestors 单次LCA/DFS
Nearest Common Ancestors Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 19919 Accept ...
- 记一次centos7.2下用crontab执行定时任务的过程(初级)
实验目的:每分钟往某个文件写数据(crontab最小单位是分钟),具体shell命令我是放在一个文件里的.先创建两个空文件:/tmp/a.txt(目标文件)和/tmp/a.sh(脚本文件). 命令如下 ...
- PID DC/DC Converter Controller Using a PICmicro Microcontroller
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en011794 ...
- TLC2262和TLC2264 轨对轨运算放大器
TLC2262和TLC2264分别是TI公司双路和四路运算放大器,两种器件可以在单电源或双电源条件下供电,从而增强了动态的范围,可以达到轨对轨输出的性能.TLC226X系列与TLC225X的微功耗和T ...
- Android 官方文档:(一)动画和图像 —— 1.5 画布和画图
The Android framework APIs provides a set 2D drawing APIs that allow you to render your owncustom gr ...
- 求平方根C++
求平方根,正根.曾经都不会.昨天看数学,看到了,写了出来.自己又小优化了一下,非常不错. // squareRoot.cpp -- 2011-08-29-01.04 #include "st ...
- Oracle中空值与数字相加问题
select 10 + 10 + 10 from dual 结果是30,全然没问题. select null + 10 + 10 from dual 结果是空串,但期望的结果是20. select n ...