3

MySQL and PostgreSQL introduced JSON data types, is it the same as NoSQL database?

Why?

NoSQL here is a class of data bases similar to MongoDb and DynamoDB.

1
  • 2
    I am voting to leave this open as I do not believe that it is opinion based. The question requires a technical answer on the differences between NoSQL and a RDBMS using JSON as a column type. This can be answered with facts and not opinions. Dec 29, 2018 at 21:55

1 Answer 1

2

A relational DBMS processes data as relations, which is just a fancy way of saying tables consisting of rows and columns. Even if a column's type is defined as JSON, to the DBMS it is still a single column's value. There's an analogy with, say, a column defined as decimal. Externally we may say that column has an integer part, a fractional part, a number of decimal places and so on. To the DBMS, however, it is a single column's value.

The same holds even if code pulls values from within the JSON. These pulled values will be presented to the consumer as columns within a row. This row will be part of a relation (i.e. a table), and every row in that relation will have the same structure. Just because a query's result set is constructed on-the-fly at run-time it is no less a relation than those defined through a CREATE TABLE statement.

A NoSQL DBMS (and here I believe you mean the document DB variety, like MongoDB, rather than key-value or columnstores), however, thinks of data as JSON documents. It accepts well-formed JSON as input and returns JSON in response to queries. This is its model. It sees the world as documents, not tables.

In both models it is the interface between the client and the server that is the distinguishing feature. What each DBMS chooses to do internally is nobody's business but its.

3
  • I'v put MongoDb and DynamoDB in the question to clarify the question. Thanks for pointing this out. Dec 30, 2018 at 22:58
  • I see the main point of your answer as "the interface between the client and the server that is the distinguishing". I'm sorry, I cannot accept it. I'm sure that there is more to it. It is like saying a cow and a pig is different because they taste differently and a pig looks at the world from a lower point. As a pig expert :) I can say that pigs breed, grow, kept and fed differently, they tolerate weather condition differently and produce less milk. Dec 30, 2018 at 23:13
  • I'm saying a document database is a document database because it processes (JSON) documents and a relational database is a relational database because it treats the world as relations. Implementing JSON datatype in Postgres does not make it a document store any more than adding DBRefs to Mongo makes it relational. Of course there are a lot of "yes but.." & "what if.." subtilties to the discussion. I read you question as adressing the ethos of the two models, not each product's internal implementation details. Dec 31, 2018 at 6:50

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