malli
malli

Reputation: 131

Couchdb database design options

  1. Is it recommended to have a separate database for each document type in couchdb or place all types of documents in a single database?
  2. Is there any limitation on the number of databases that we can create on couchdb?
  3. Are there any drawbacks in creating large number of databases in couchdb?

Upvotes: 6

Views: 970

Answers (1)

Eli Stevens
Eli Stevens

Reputation: 1447

  1. There is no firm answer. Here are some guidelines:

    • If two documents must be visible to different sets of users, they must be in different DBs (read/write privs are per-DB, not per-doc).
    • If two documents must be included in the same view, they must be in the same DB (views are for a single DB only).
    • If two types of documents will be numerous and never be included in the same view, they might as well be in different DBs (so that accessing a view over one type won't need to process all of the docs of the other type).
    • It's cheap to drop a database, but expensive to delete all of the documents out of a database. Keep this in mind when designing your data expiration plan.
  2. Nothing hardcoded, but you will eventually start running into resource constraints, depending on the hardware you have available.

  3. Depends on what you mean by "large numbers." Thousands are fine; billions probably not (though with the Cloudant changes coming in v2.0.0 I'd guess that the reasonable cap on DB count probably goes up).

Upvotes: 6

Related Questions