Multiple couchdb databases

I'm used to working with mysql, but for my next series of projects, CouchDB (NoSQL) seems to be suitable in order to avoid EAV in mysql and cover all the interesting functions that it has to offer.

After much research and documentation for reading, etc. There is one thing that I do not seem to understand very well.

Suppose I have three web applications on my server and therefore you need three databases. For example, one is an online store with tables of goods and accounts, one is a blog with tables of articles and comments, and the other is a web game with tables of game statistics (obviously, a simplification).

Therefore, I host several sites with one mysql installation, and each application that I run on my server gets its own database with tables, fields and content.

Now, with CouchDb, I want to do the same. The problem is that creating a database in CouchDb is more like creating a table in mysql. That is, I create databases called "comments", "articles", etc. For my weblog and inside. I create a document per article or document for comment.

So my question is: how can I separate my data from multiple web applications on a single CouchDB installation?

I think I'm doing something fundamentally wrong here, but hopefully one of you guys can help me get on the right track.

+8
database couchdb
source share
3 answers

In CouchDB, there is no explicit need to separate unrelated data in multiple databases. If you have correctly built your documents and views, only relevant data will be displayed in your queries.

If you decide to split your data into separate databases, just create a new database.

$ curl -X PUT http://localhost:5984/somedb {"ok":true} 
+6
source share

From my experience with couchdb, splitting unrelated data into different databases is very important for performance as well as without problems. Perception of submission is a painful part of couchdb. Each time the database is updated, the views (counting them as indices in traditional relational sql db) must be restored. This includes an iteration of each document in the database. So, if you said 2 million documents of type A, and you have 300 documents of type B. And you need to restore the type of requests of type B, then all 2 million and 300 hundred transfers will be performed during the creation of the view, and this (this can even be done read timeout).

Consequently, having multiple databases does not require much effort when it comes to saving views (as you request in couchdb, this is obviously an important and inevitable function).

+4
source share

@Zombies are extremely right about performance. CouchDB is not suitable for executing a large number of documents in a single database. If you need to execute, say, more than 5,000 documents, MongoDB will be outperfom CouchDB.

Representations in CouchDB are necessary, but painful, with limited JavaScript capabilities to create your queries (don't even think about document links or nested objects). Considering the availability of multiple databases for different documents is quite a solution. Some people will say something like:

CouchDB is a NoSQL database, and so you don’t need to order documents or filter them with anything other than views. The main function of the NoSQL database is the ability to store documents without a schema [...]

And I find it very annoying when you need to find a workaround to the request and . You should not mind creating multiple databases to share your data if it allows you to share your data, and it will still be on the same CouchDB installation. Remember that CouchDB is suitable for small databases . The smallest database will be, the faster your query, the better the performance.

(I don't know if there are any English errors, forgive me if so)


EDIT Some companies, such as ArangoDB , have made a comparison between themselves, MongoDB and CouchDB, and this confirms my statement about the number of documents. This is the result:

Graphical comparison

There are many other resources on their website. On the other hand, this expression was a personal experience, and comparing them for my internship with the .PHP comparison software I found on the Internet. The results are shown below:

enter image description here

+2
source share

All Articles