The statement that NoSQL databases are better for unstructured data because of their schemaless nature can be found everywhere. Frankly, I don't understand that. A human voice recording is often be used as an example for unstructured data. I can store it in a relational database with datatype BLOB, in a well defined schema. Can somebody explain?

  • 1
    Care to provide at least one authoritative source of that broad claim? "Can be found everywhere" is not very useful. – mustaccio Jan 22 '18 at 18:22

The term "unstructured data" has many connotations and probably may mean different things for different people. And a voice recording is definitely not the best example for "unstructured data". As you said, it can simply be represented as a blob in an RDBMS. Similarly a large text document can be stored as text type in RDBMS. When it comes to unstructured/semi-structured data, you may not know all the attributes of the data upfront. As RDBMS expects you to define everything upfront (esp the column name and datatype), it will be hard to manage this kind of data in an RDBMS.

Lets us say, you want to track per user when is the last time he visited a country. You also want to look up the date quickly given a country name. In a NoSQL database you can model the table in such a way that country name is a column and the cell will have the last visited date. You do not need to create all the columns (with all possible countries) upfront. As and when you want to add information for a user, you can add the country column and the last visited date. When you want to know when the user visited a country 'x', you can query only for that column for the userid (primary key).

  • There are use-cases where the NoSQL approach is better, but in the example given with users visiting countries and storing the last visited date: In an RDBMS that's just a table user_country with primary key (userid, country) and an additional column last_visited_date. SELECT last_visited_date FROM user_country WHERE userid = ? AND country = ?; – dbdemon Feb 14 '18 at 10:26
  • Agreed. There are pros and cons in both models. In this RDBMS datamodel, if you want to read all countries of a user, the query will result in 1 I/O per country in the worst case as they are separate rows. Whereas, in a typical row-oriented NoSQL, it will be a single I/O, as the primary key is on userid only. In case of NoSQL, the updates to a single country pay more cost as the entire row will get updated. So, it is 1 I/O but larger I/O compared to your RDBMS datamodel where the I/O size is small. Composite primary keys also comes with baggage of how you can partition the table. – sunil Feb 20 '18 at 6:23

Check the comparison where NoSQL has better results.

NoSQL databases can store structured, semi-structured and unstructured data. Their main advantages focus on semi-structured (JSON, XML, not all fields are known) and unstructured.

But, you can safely store BLOB in a RDBMS, e. g., Oracle Database and many others relational databases.

The people talking about NoSQL be a better sollution to store unstructured data, not always had built an IT infrastructure, and they're replaying what they heard.

Also the trend to think that newer is always better push to this.

But some scenarios NoSQL+unstructured data could be better: to scale out, hundreds of db instances, big data and cloud.

  • 2
    Well... I know, that NoSQL-DBs can store all kinds of data. That was not my question. And I know, that I can store BLOBs in RDBMS. I wrote that. My question was, WHY everywhere on the internet the statement can be found, that NoSQL-DBs are a better solution for unstructured data. – derzeit Jan 22 '18 at 16:39
  • Now I got and I agree with your point. I'll edit the answer. – Rogerlr Jan 22 '18 at 18:43
  • I agree that NoSQL data can scale better as you dont have to define the schema upfront. But I am not necessarily sure whether its valuable to store all data. There is cost associated with storing a lot of data, security considerations. What will happen when you keep collecting data, and then you are afraid of throwing away that data, because in some distant future you could gather some insight out of that data? – alpha_989 Aug 25 '18 at 21:54

In case of CLOB or BLOB, you can not perform any query on the data looking for a key value.

What if someone has sent you a comment on your article with some racial words in between and you haven't read the comment logs at all.

How will you analyze your logs content looking for a key word if each comment is stored in CLOB or blob?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.