ITeye博客

mongo delete data

dikar · 2011-05-04 13:23 · mongoDB · 编程语言 · SQL · MongoDB · Markdown

mongo中和普通的sql一样提供了delete接口,不过针对delete有些不一样的是,被删除的数据磁盘空间不会立即释放,而是会重用

 

见 http://www.mongodb.org/display/DOCS/Excessive+Disk+Space

Deleted Space

MongoDB maintains deleted lists of space within the datafiles when objects or collections are deleted.  This space is reused but never freed to the operating system.

To compact this space, run db.repairDatabase() from the mongo shell

this operation will block and is slow.

When testing and investigating the size of datafiles, if your data is just test data, use db.dropDatabase() to clear all datafiles and start fresh.

 

 

同时针对想释放空间的用户可以看以下2篇文章的讨论

MongoDB data remove - reclaim diskspace

http://stackoverflow.com/questions/5518581/mongodb-data-remove-reclaim-diskspace

 

 

Auto compact the deleted space in mongodb

http://stackoverflow.com/questions/4555938/auto-compact-the-deleted-space-in-mongodb/4560096#4560096

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。