Update $unset command eats up all ram on large collection
Using MongoDB, I'm trying to remove a column from a collection that contains ~3 million records.
db.Li开发者_开发知识库sting.update( {}, { $unset: { Longitude: 1 } }, false, true);
When I execute this command, the RAM on the server continues to go up until it runs out of RAM and then the server is hosed and needs to be physically rebooted. Is there a better way to remove a column from a large collection that won't hose the server?
I expect your problem is the system OOM killer. You should make sure you aren't limiting the resources for mongod. See this: http://www.mongodb.org/display/DOCS/Checking+Server+Memory+Usage
http://prefetch.net/blog/index.php/2009/09/30/how-the-linux-oom-killer-works/
If you are using a virt. system like openvz you might want to stop , or adjust the over-committing feature.
精彩评论