Google Groups

Re: [mongodb-user] Sharding a database so that some collections are on one shard and the remainder on another

NoelD May 1, 2012 4:37 PM
Posted in group: mongodb-user
On Wednesday, May 2, 2012 11:10:10 AM UTC+12, Scott Hernandez wrote:
Yes it is not possible, so people do put things in different databases so
they can be spread out to different shards.
Thanks for confirming this.

Can you explain why you need to do this? Is it just that you have many
collections which are small and don't need to be sharded?

We have a single database with some twenty collections, although this number is growing. We have been slow to shard the collections because once we choose a shard key, we cannot change it. The problem we are trying to solve is write performance - we write lots of data from mapreduce jobs and the single-threaded write is a bottleneck. We hoped that by splitting the database into two shards that we could increase the write performance by having reducers writing data to different collections in different shards at the same time.
There is nothing more complicated about doing a query in one database
or another for collection. Queries can only be done in a single
collection anyway -- so moving them between databases shouldn't be an

Good point.