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.
相关问题
- MongoDB can not create unique sparse index (duplic
- SQL join to get the cartesian product of 2 columns
- sql execution latency when assign to a variable
- Difference between Types.INTEGER and Types.NULL in
- php PDO::FETCH_ASSOC doesnt detect select after ba
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.
Edureka videos in youtube regarding NoSQL are some of the best video tutorials.
https://www.youtube.com/watch?v=gJFG04Sy6NY
https://www.youtube.com/watch?v=KSq6tMMXZ8s
https://www.youtube.com/watch?v=3z1KFA2qcSo
Good presentations are available in slideshare.net
http://www.slideshare.net/quipo/nosql-databases-why-what-and-when?qid=3bb9f7f6-a53d-41b1-8403-cd6f181d0ca7&v=qf1&b=&from_search=1
http://www.slideshare.net/EdurekaIN/no-sql-databases-35591065?qid=f1b9c095-6d70-4d0a-91da-1df664c4f389&v=qf1&b=&from_search=3 (This presentation supports video tutorial in youtube)
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
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
utilityAt 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:
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
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
For some use cases you need, especially for analytic queries you can run SQL queries on MongoDB with this wrapper from Postgres.