Search code examples
mongodbdockersharding

How many shards should I make for my data base


I'm creating a database (MongoDB) in Docker, which contains about 20 collections, each collection contains a different amount of data from 0 to 40 million. I found that if I put them all in one instance, the query will be vert slow so I'm thinking about making shards. But I'm not sure the amount of the sharding. So how many shards should I create for my database to have the best searching efficiency?


Solution

  • There is no precise answer to your question.

    You should test various configuration.

    And of course, the number depends on your hardware potential.