简体   繁体   中英

In mongodb is there a performance reason to separate collections into more than on database?

I have an application using a MongoDB database and am about to add custom analytics. Is there a reason to use a separate database for the analytics or am I better off to build it in the application database?

Here are the reasons I can think of:

  • Name collisions between production collections and analytics collections
  • You need a different replica set configuration for analytics
  • You need a different sharding configuration for analytics
  • You want different physical media for some data (production data on fast disks, analytics on slow disk, for example)
  • Starting in Mongo 2.2, the "global write lock" will be a per-database lock, so different databases will isolate analytics traffic from production traffic a bit more.

Unless something on this list applies to you, then you don't need to split them out. Also, it's much easier to move a collection across DBs in MongoDB than an RDBMS (as you don't have foreign keys to cause trouble), so IMO it's a relatively easy decision to delay.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM