7

Huge collections have huge indexes that may not fit into RAM. Is that problem entirely solved with sharding ?

If I have lots of small collections with small indexes, what are the options for storing them ? Since only very few of them would be bigger than 200mb they wouldn't be eligible for sharding. What MongoDB database architecture can hold a huge number of fairly small collections ? Since all the queries would be to a specific collection, would this be as fast as a targeted query in a sharding environment ? Faster ?

1 Answer 1

3

The smaller the collection the better. Yes if the index does not fit into ram it will be come slower. the way most index searching works is based on binary searching. Its a great method. I build a little test last week in PHP and you can have a list of 1000 numbers and you will be able to find each number in about 12.3 comperasons. So think of it that way. If you a table of 1000 items only having to check 12 times to find the correct result is pretty good in my book. The more documents you add in mongo the more operations that have to take place.But its imporant not to make them to small that your server has to keep switching for simple things.

Also make sure to remember that each document has a max size of about 18mb I think. That is a lot of data. Look up how many words are in the book "war and peace" and that can fit in about 3mb of data. But dont let it control you over stuffing things or under stuffing them.

1
  • Minor correction - Max size is 16mb per document Commented Oct 30, 2017 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.