Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it normal size for MongoDB?

Tags:

mongodb

I just import my Mysql database (size 2,8 Mio) in my new Mongo database with very simple php script i build, import was ok without error but when i look my Mongo database (with RockMongo) i can see this : Data Size 8.01m, Storage Size 13.7m.

MongoDB is bigger than Mysql for the same amount of data, is this normal ?

Thanks for your help and sorry for my english.

like image 804
Tahola Avatar asked Feb 07 '11 07:02

Tahola


People also ask

What is default size of MongoDB?

The default size of GridFS chunks in MongoDB is 255 KB, as per the order GridFS will divide our documents into the number of chunks file. MongoDB GridFS is using two collections to store this type of documents.

How much space does MongoDB need?

MongoDB requires approximately 1 GB of RAM per 100.000 assets. If the system has to start swapping memory to disk, this will have a severely negative impact on performance and should be avoided.

Is MongoDB Big Data?

Modern big data databases such as MongoDB are engineered to readily accommodate the need for variety—not just multiple data types, but a wide range of enabling infrastructure, including scale-out storage architecture and concurrent processing environments.

Is MongoDB good for small project?

Yes, MongoDB is good for small projects. MongoDB is an amazing database technology that will let you structure small sets of data however you want into a small file size. With that said, the best tools and resources for you depends on the project and the data you are storing.


1 Answers

Yes, it's normal that the "same" data will take up more space in mongodb. There's a few things you need to take into account:

1) the document _id that's stored for each document (unless you are specifying your own value for that) is 12 bytes per doc
2) you're storing the key for each key-value pair in each document, whereas in MySql the column name is not stored for every single row so you have that extra overhead in your mongodb documents too. One way to reduce this is to use shortened key names ("column names") in your docs
3) mongodb automatically adds padding to allow documents to grow

In similar tests, loading data from SQL Server to MongoDB, with shortened 2 character document key names instead of the full names as per SQL Server, I see about 25-30% extra space being used in MongoDB.

like image 84
AdaTheDev Avatar answered Oct 23 '22 17:10

AdaTheDev