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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -