Re: is there an advantage to having multiple collections instead of a single collection? or vice versa?

53 views
Skip to first unread message

Mark

unread,
Jul 16, 2012, 2:02:15 PM7/16/12
to mongod...@googlegroups.com
Well, when 2.2 is out, each collection in their own database should get a boost with database level locking. 

Documents have a certain size limit, that might decide whether you want to combine them or not. Also, are you saving the assets on disk and referring to them in the database? Or are you storing the entire asset in the database?

On Monday, July 16, 2012 9:08:53 AM UTC-7, Daniel wrote:
We have several models: Image, Video, Document. These could be stored in a single assets collection, or they could each be their own collection (image_assets, video_assets, document_assets). Is there a performance benefit (eg: shard each collection independently, or just by virtue of having fewer items) to splitting them up into separate collections?

Thank You,

Daniel

Daniel Nelson

unread,
Jul 16, 2012, 3:47:39 PM7/16/12
to mongod...@googlegroups.com
> Well, when 2.2 is out, each collection in their own database should get a
> boost with database level locking.

Okay, well that is a vote for separate collections.

> Documents have a certain size limit, that might decide whether you want to
> combine them or not. Also, are you saving the assets on disk and referring
> to them in the database? Or are you storing the entire asset in the
> database?

I'm actually in the process of migrating from embedded objects within
an AssetLibrary model to top-level documents (each Image, Video, and
Document object as its own Mongo document) because we are seeing use
cases in which a single user creates thousands of assets.

The actual resources referenced by the assets (images, videos, and
documents) are stored on S3.

Thank You,

Daniel

Jeremy Wilson

unread,
Jul 16, 2012, 11:00:07 PM7/16/12
to <mongodb-user@googlegroups.com>

On 2012-07-16, at 2:02 PM, Mark wrote:

> Well, when 2.2 is out, each collection in their own database should get a boost with database level locking.

I have a question - if I can just put one collection in 1,000 databases, why don't you just do that behind the scenes and call it "collection level locking"?

Eliot Horowitz

unread,
Jul 17, 2012, 1:10:56 AM7/17/12
to mongod...@googlegroups.com
There is overhead per db, so not sure 1000 databases will perform great.
2.2 also continues all of the yielding work, so fewer dbs should work very well.
If you still want to do something, you could have 50 dbs, each with 20
collections, and just hash collections into dbs.
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user...@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb
Reply all
Reply to author
Forward
0 new messages