开发者

Should I really put all my different types of data in one database?

开发者 https://www.devze.com 2023-03-30 19:17 出处:网络
Quote from CouchDB guide: MapReduce can be challenging, especially if you’ve spent years working with relational databases.

Quote from CouchDB guide:

MapReduce can be challenging, especially if you’ve spent years working with relational databases.

I'm exactly in that situation. With the difference that for me this applies not only for MapReduce but for the whole concept of schemafree'ish databases... ;)

Am I really free to put all my data in the same database, regardless of how different they are (users, sessions, etc.)开发者_开发问答? Since views work on database level I understand that I should (need?).

PS: I'm aware that this I a pretty unspecific question and that it depends on the specific needs... :)


For prototyping, or learning CouchDB, or otherwise early-stage projects, I suggest that you keep everything in the same database. Keep it simple. Focus on building the software.

As your project evolves, it will be obvious when to expand into more databases.

If your application's users will connect directly to CouchDB, there are two considerations:

  1. User accounts are already in a separate database called _users. CouchDB uses this to confirm passwords and handle authentication
  2. Access control (in particular, permission to read data) is controlled at the database level. Users can read a database either completely, or not at all. When your application begins to maintain private data per user, that is a good situation to create multiple databases.

Sometimes, users never connect to CouchDB directly. Consider a traditional 3-tier application stack with a web server front-end and a database back-end. Much like MySQL or any other database, from CouchDB's perspective, you have only one database user: the web server. In that case, splitting into multiple databases is largely an optimization which can be postponed until the requirements are clear.

0

精彩评论

暂无评论...
验证码 换一张
取 消