Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why exactly do we use NoSQL? [closed]

Tags:

Having understood some of the advantages that NoSQL offers (scalability, availability, etc.), I am still not clear why a website would want to use a non-relational database. Can I get some help on this, preferably with an example?

like image 350
Tian H. Avatar asked Jun 18 '10 07:06

Tian H.


People also ask

Why do we use NoSQL?

NoSQL databases have become popular because they store data in simple straightforward forms that can be easier to understand than the type of data models used in SQL databases. In addition, NoSQL databases often allow developers to directly change the structure of the data.

When should NoSQL not be used?

You should also avoid NoSQL if your application needs run-time flexibility. If consistency is a must and if there aren't going to be any large-scale changes in terms of the data volume, then going with the SQL database is a better option.

What is NoSQL why we need NoSQL?

NoSQL databases store data in a single data format, including a JSON document, rather than the traditional table structure of a relational database. Because this non-relational database architecture doesn't really need a structure, it can quickly handle massive, often unorganized data sets.

Why use a NoSQL database?

Blog > 7 Reasons to Use a NoSQL Database. The use of NoSQL databases has increased because they handle mission-critical applications so well. A NoSQL database stores & retrieves information differently than the fixed table approach used in relational databases where information is retrieved with Structured Query Language (SQL).

Does a NoSQL database support agile development?

By contrast, a NoSQL database fully supports agile development and does not statically define how the data must be modeled. Instead, NoSQL defers to the applications and services, and thus to the developers as to how data should be modeled.

Is NoSQL better for scalibility than SQL?

Originally Answered: Is NoSQL better for scalibility than SQL? How do I choose between NoSQL and relational databases? NoSQL is more flexible for inserting data when you can’t predict the structure of your data. But it makes it harder to run optimized queries later.

Should you choose a NoSQL database like MongoDB?

For example, some applications storing most of their data in a document database like MongoDB, but supplement that with a graph database to capture inherent connections between people or products. If you have these requirements, then you should consider adopting a NoSQL database like MongoDB.


2 Answers

Better performance

NoSQL databases sometimes have better performance, although this depends on the situation and is disputed.

Adaptability

You can add and remove "columns" without downtime. In most SQL servers, this takes a long time and takes up a load of load.

Application design

It is desirable to separate the data storage from the logic. If you join and select things in SQL queries, you are mixing business logic with storage.

like image 90
Sjoerd Avatar answered Sep 21 '22 13:09

Sjoerd


NoSQL databases are there to solve several things, mainly:

  • (buzz) BigData => think TB, PB, etc..

  • Working with Distributed Systems / datasets => say you have 42 products, so 13 of them will live in Chicago datacenter, 21 in NY's and another and 8 somewhere in Japan, but once you query against all 42 products, you would not need to know where they are located: NoSQL DB will. This also allows to engage a lot more brain power ( servers ) to solve hard computational problems [ does not seem it would fit your use case, but it is an interesting thing to note ]

  • Partitioning => having your DB be easily distributed, besides those cool 8 products in Japan, also allows for an easy data replication, so those 42 products will be replicated with a factor of 3, for example, which would mean you DB would have 3 copies for every product. Hence if something goes down, no problem => here is a replica available. This is where NoSQL databases actually shine vs. RDBMS. Granted you can shard, partition and cluster Oracle / MySQL / PostgreSQL / etc.. BUT it is a several magnitudes more complicated process and usually a maintenance headache for most people you'd employ.

BUT to your question:

  • why a website would want to use a non-relational database

When most of the people, I worked with / met / chatted with, choose NoSQL for their "website", it is unfortunately NOT for the reasons above, but simply because it is COOLER to do so. And in fact many projects FAIL / have extreme difficulties due to this reason.

If most of NoSQL gurus take their masks off, they will all agree that MOST of the problems ( or as people call them websites ) that developers solve day to day, can and rather be solved with a SQL solution, such as PostgreSQL, MySQL, etc.. with some cool Redis cache layer on top of it. And only a small subset of problems would REALLY benefit from NoSQL.

I personally love Riak, as I am a firm believer that a NoSQL, fault tolerant DB should have an extremely strong, flexible and naturally distributed foundation => such as Erlang OTP. Plus I am a fan of simplicity. But again, given the problem, I would choose whatever works best, and most of the time I will NEED that consistency ( especially if we are talking about money / financial world / mission critical / etc.. ).

like image 40
tolitius Avatar answered Sep 23 '22 13:09

tolitius