Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why use NoSQL over Materialized Views?

There has been a lot of talk recently about NoSQL.

The #1 reason why I hear people use NoSQL is because they start to de-normalize their DBMS data so much so, to increase performance, that they end up with just one table with all of their data within that single table.

With Materialized Views however, you can keep your data normalized, yet have it stored as a single table view for the same reasons why you'd use NoSQL.

As such, why would someone use NoSQL over Materialized Views?

like image 337
JustinT Avatar asked Apr 09 '10 13:04

JustinT


People also ask

Why do people prefer NoSQL?

The primary reason to choose a NoSQL database is easy scalability. Well, relational databases can also be scaled but not easily and at a lower cost. Relational databases are built on the concept of traditional master-slave architecture.

Why is NoSQL better for analytics?

Storing capacity of large volumes of unstructured data: A NoSQL database can store unlimited sets of data with any types. Moreover, it has the user flexibility to change the data type on the go. It is a document based database. Hence, no need to define the data type in advance.

Why does NoSQL have better performance?

NoSQL databases, as they are designed to be flexible and fast, have less constraints than SQL by reducing the overhead of consistency. As for flexibility, NoSQL can store data in several types like objects (documents or key-value pair) distributedly.


2 Answers

One reason is that materialized views will perform poorly in an OLTP situation where there is a heavy amount of INSERTs vs. SELECTs.

Everytime data is inserted the materialized views indexes must be updated, which not only slows down inserts but selects as well. The primary reason for using NoSQL is performance. By being basically a hash-key store, you get insanely fast reads/writes, at the cost of less control over constraints, which typically must be done at the application layer.

So, while materialized views may help reads, they do nothing to speed up writes.

like image 126
D'Arcy Rittich Avatar answered Sep 28 '22 08:09

D'Arcy Rittich


NoSQL is not about getting better performance out of your SQL database. It is about considering options other than the default SQL storage when there is no particular reason for the data to be in SQL at all.

If you have an established SQL Database with a well designed schema and your only new requirement is improved performance, adding indexes and views is definitely the right approach.

If you need to save a user profile object that you know will only ever need to be accessed by its key, SQL may not be the best option - you gain nothing from a system with all sorts of query functionality you won't use, but being able to leave out the ORM layer while improving the performance of the queries you will be using is quite valuable.

like image 42
Tom Clarkson Avatar answered Sep 28 '22 07:09

Tom Clarkson