indexing - Choosing the right shard key in MongoDB -


we building our first mongodb , trying choose right shard key.

each document in our main collection contain around 40 voice call related fields , main field use in queries userid field. why thinking compound shard key of userid , callstarttime.

they not sure regarding second field since starttime advancing , 1 might argue not random enough. led consider replace userid , hashed _id (mongo internal id after hash).

is first option ok or better use latter?

consider recommendations in documentation here: http://docs.mongodb.org/manual/core/sharded-cluster-internals/#shard-keys

or, if there no natural choice, consider using hashed shard key (mongodb 2.4+) http://docs.mongodb.org/manual/reference/glossary/#term-hashed-shard-key


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

php - Dynamic url re-writing using htaccess -

java - Multi-Label Document Classification -