MongoDB query on all sharded collections without shardkey

强颜欢笑 提交于 2019-12-02 10:10:42

For ideal performance, shard keys should be chosen in a way the router (mongos) can tell which shard will have the data for the most common queries. This is only possible when the find-query has a criteria which is also the shard-key.

But in this case it is impossible for the router to tell which shard has the data for the query. It is not unlikely that there are relevant results on every shard. In that case the query needs to be forwarded to all shards, which will process it simultaneously. But when you have an appropriate index, this will help them doing so.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!