Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the best uses of document stores?

Tags:

I have been hearing a lot about document oriented data stores like CouchDB. I understand the uses of BigTable like stores such as Cassandra. After reading this question, I was wondering what the conditions would be to merit using a document store?

like image 271
Mantas Vidutis Avatar asked Jul 31 '10 03:07

Mantas Vidutis


People also ask

What are document stores used for?

A document-oriented database, or document store, is a computer program and data storage system designed for storing, retrieving and managing document-oriented information, also known as semi-structured data.

What are the advantages of document stores?

Probably the biggest benefit of document-store is that everything is available in a single database, rather than having information spread across several linked databases. As such you get better performance compared to an SQL database as long as you don't use relational processes.

What is document database good for?

A document database is a type of nonrelational database that is designed to store and query data as JSON-like documents. Document databases make it easier for developers to store and query data in a database by using the same document-model format they use in their application code.

How do document stores work?

What is a Document Store? Document-oriented databases, also known as document stores, are used to manage semi-structured data. This data does not adhere to a fixed structure, instead it forms its own structure. The information can be ordered using markers within the semi-structured data.


1 Answers

Column-family stores such as Bigtable and Cassandra have very limited querying capabilities. The application is responsible for maintaining indexes in order to query a more complex data model.

Document databases allow you to query the content, not just the key. It will also manage the indexes for you, reducing the complexity of your application.

Domain-driven design evangelizes the use of aggregates and value objects. As Ayende points out, (complex) aggregates are very natural candidates to be stored as a single document, instead of normalizing them over multiple tables or column families. This will reduce the complexity of your persistence layer. There's also less chance that related data is scattered across multiple nodes, as all the data is contained in a single document.

If your application needs to store polymorphic objects, document databases are also a good candidate. Of course, this could also be stored in Cassandra, but you won't have as much querying capabilities. At least not out of the box.

Think of a document database as a luxurious sports car. It doesn't need a professional driver (read: complex application) to get you from A to B, it has features such as air conditioning and comfortable seats and it will lap the high-scalability track in an acceptable time. However, if you want to set a lap record on the high-scalability track, you will need a professional driver and a highly optimized car (e.g. Cassandra), which lacks features such as air conditioning.

like image 95
Niels van der Rest Avatar answered Oct 12 '22 20:10

Niels van der Rest