Afshin Mehrabani
Afshin Mehrabani

Reputation: 34929

Shard key and how to choose it?

I'm new in NoSQL databases and now I use MongoDB, BTW I have a question about MongoDB shard key and I want to know what it does actually? Is it related to queries performance? And how we can choose a good shard key for a collection?

Thanks in advance

Upvotes: 1

Views: 2518

Answers (2)

deepakmodak
deepakmodak

Reputation: 1339

You can have more explanation on shard key selection and working in Kristina Chodrow's book "Scaling MongoDB"

Check out this also

Upvotes: 1

Randall Hunt
Randall Hunt

Reputation: 12572

From 10gen's docs: http://www.mongodb.org/display/DOCS/Choosing+a+Shard+Key

Choosing a shard-key is very dependent on your data and your use case.

Here's some more documentation you may find relevant:

http://docs.mongodb.org/manual/faq/sharding/

http://docs.mongodb.org/manual/sharding/

Specifically:

http://docs.mongodb.org/manual/core/sharding/

Essentially sharding allows you to partition your data across different servers. This means different writes/reads are going to different servers -- distributing the load of the application across multiple servers.

The shard key is the value in the collection that you are evaluating to determine which shard/server the document is being routed too.

Upvotes: 3

Related Questions