Use cases for NoSQL [closed]
Asked Answered
V

8

147

NoSQL has been getting a lot of attention in our industry recently. I'm really interested in what peoples thoughts are on the best use-cases for its use over relational database storage. What should trigger a developer into thinking that particular datasets are more suited to a NoSQL solution. I'm particularly interested in MongoDB and CouchDB as they seem to be getting the most coverage with regard to PHP development and that is my focus.

Verbenia answered 20/5, 2010 at 15:46 Comment(2)
Cassandra and MongoDB are completely different products - completely different categories. This question would be easier to answer if it were asking about use cases for a specific type of database (OODB, DODB, DKVS, etc.) "NoSQL" is just an umbrella term for "anything that isn't SQL" - it could just as well be something like BerkleyDB or a bunch of flat files sitting on a network share.Freestanding
@Freestanding i appreciate the differences, i guess i'm maybe guilty of using an umbrella term with nosqlVerbenia
V
50

Some great use-cases - for MongoDB anyway - are mentioned on the MongoDB site. The examples given are real-time analytics, Logging and Full Text search. These articles are all well worth a read http://www.mongodb.com/use-cases

There's also a great write-up on which NoSQL database is best suited to which type of project: http://kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redis

Verbenia answered 26/5, 2010 at 8:24 Comment(0)
V
86

Just promise yourself that you will never try to map a relational data model to a NoSQL database like MongoDB or CouchDB... This is the most common mistake developers make when evaluating emerging tech.

That approach is analogous to taking a car and trying to use it to pull your cart down the road like a horse.

It's a natural reaction due to everyone's experience of course, but the real value in using a document database is being able to simplify your datamodel and minimize your suffering as a developer. Your codebase will shrink, your bugs will be fewer and easier to find, performance is going to be awesome, and scale will be much simpler.

As a Joomla founder I'm biased :-) but coming from the CMS space, something like MongoDB is a silver bullet as content maps very naturally to document systems.

Another great case for MongoDB is real-time analytics, as MongoDB has very strong performance and scale particularly regarding concurrency. There are case studies at the MongoDB.org website that demonstrate those attributes.

I agree with the notion that each database has its own aims and use cases; take the purpose of each database for evaluation accordingly.

Vermont answered 24/5, 2010 at 20:7 Comment(1)
truly well said spacemonkey, i am in the same position as seengee, clearly we are to think in a new way and should ask ourselves how do i structure my applications data into a document structure, removing ourselves from the RDBMS way of thinking when we do this analysisDillion
V
50

Some great use-cases - for MongoDB anyway - are mentioned on the MongoDB site. The examples given are real-time analytics, Logging and Full Text search. These articles are all well worth a read http://www.mongodb.com/use-cases

There's also a great write-up on which NoSQL database is best suited to which type of project: http://kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redis

Verbenia answered 26/5, 2010 at 8:24 Comment(0)
C
14

I'd suggest this article by Rick Cattell about miscellaneous data stores (a.k.a. NoSQL), their differences and some of their use-cases: http://www.cattell.net/datastores/index.html

Calyptrogen answered 24/5, 2010 at 15:39 Comment(0)
N
10

I have been using NoSQL DBs for a while now, and this is my contribute to the topic:

A great use case for a NoSQL database is an application for statistics and / or reports generation, expecially when data is provided from a third party source.

In a situation like that a NoSQL database can be a great choice

Let's consider, for example, MongoDB:

Once you have your data in JSON, ( it could come from a third party API, or be exported from an sql-application) in MongoDB is pretty strightforward to import and update the JSON data in the database; for example using the command-line mongoimport utility

At this point is very simple to build dynamic queries with filtering and grouping, that well fit with this kind of application.

For example, using the Aggregation Framework:

$pipeline = [];

//filter by date
$pipeline[] = [ '$match' => [ 'created_at' => [ '$gte' => $starDate, '$lte' => $endDate ]  ]  ];

//if we want to filter by a specific field, we add the filter to the pipeline array
if( $filters->isFilterByField() )
    $pipeline[] = [ '$match' => [ 'field' => $fieldValue ] ];    

//group the results by date and get the count
$pipeline[] = [ '$group' => [ '_id' => '$created_at', 'num_elements' => [ '$sum' => 1 ] ] ];

return $collection->aggretate( $pipeline );

I'd like to point up the easiness with which we can dinamically add/remove filters using php data structures and avoiding tedious string concatenation to build up our queries. With this approach adding/removing filters dinamycally is as easy as adding / removing elements from an array

Another great benefit comes from the fact that a solution like this is likely to be faster than using a relational database, where we have to make joins with different tables to get all the data we need

Besides, this use case is optimal because avoids all the principal limits of a NoSQL database:

  • Lack of transactions: The application doesn't perform writes but only reads, so we don't need transactions at all

  • Lack of joins between tables: We don't need joins, as we can use redundancy to store our denormalized data in the collections. As we only read data, we don't need to be worried about synchronizing denormalized data among updates.

This way we can focus on storing the data with redundancy in a manner that well fits to our queries, that will be focus on single collections.

I'm just writing this because had i read something like that some times ago, it would have been saved me some time to make researches

Hope it will be useful to someone

Neuritis answered 31/10, 2015 at 10:29 Comment(0)
M
7

What I like about NoSQL has nothing to do with performance and everything to do with usability. Document stores are just easier to work with when your atomic data units are document-like, because it's trivial to serialize to and from objects. It's just more fun, and that's an important factor for personal or side projects.

Marqueritemarques answered 20/5, 2010 at 19:37 Comment(1)
I wouldn't exactly say it's trivial, but this is otherwise a good point about Document-Oriented Databases. The reverse is actually true for some other NoSQL products - DKVSes tend to be more difficult to map than SQL/relational DBs.Freestanding
D
4

I strongly recommend this talk by Martin Fowler:

https://www.youtube.com/watch?v=qI_g07C_Q5I

ABSTRACT: Martin gives a rapid introduction to NoSQL databases: where they came from, the nature of the data models they use, and the different way you have to think about consistency. From this he outlines what kinds of circumstances you should consider using them, why they will not make relational databases obsolete, and the important consequence of polyglot persistence.

It draws a nice picture of what NoSQL is, the different categories and the things everyone has to understand when coming from relational databases world. Regards.

Denounce answered 14/7, 2015 at 7:49 Comment(1)
Understood, will keep it in mind for the future.Denounce
P
1

For some use cases you need, especially for analytic queries you can run SQL queries on MongoDB with this wrapper from Postgres.

Podgy answered 17/10, 2012 at 16:2 Comment(0)
C
1

Because there are now many more NoSQL databases on the market than ever before, I suggest having a look at the Gartner Magic Quadrant if you're looking for a database that will also be great for enterprise applications based on support, expandability, management, and cost.

http://www.gartner.com/technology/reprints.do?id=1-23A415Q&ct=141020&st=sb

I would like to suggest Couchbase to anyone who's not tried it yet, but not based on the version that is shown in the report (2.5.1) because it is nearly 2 revisions behind where CB Server is today, nearing release of 4.0 in 2H15.

http://www.couchbase.com/coming-in-couchbase-server-4-0

The other part about Couchbase as a vendor/product is that it is a multi-use type of DB. It can act as a pure K/V store, Document Oriented Database with multi-dimensional scaling, Memcached, cache-aside with persistence, and supports ANSI 92 compliant SQL with automatic joins, replication to DR clusters with the push of a button, and even has a mobile component built-in to the ecosystem.

If nothing else, it's worth checking out the latest benchmarks:

http://info.couchbase.com/Benchmark_MongoDB_VS_CouchbaseServer_HPW_BM.html http://info.couchbase.com/NoSQL-Technical-Comparison-Report.html

Chlorite answered 30/3, 2015 at 16:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.