DEV Community

Discussion on: Explain NoSQL Databases Like I'm Five

Collapse
 
awwsmm profile image
Andrew (he/him) • Edited

You can think of a regular SQL database as a list of vectors. In an SQL database, each vector must have the same length and carry the same kind of data at the n-th index:

[ // the database itself is a "list of vectors"
  ["string", false, 3.14] // each row is a fixed-length "vector"
  ["another", true, 2.781828] // values at a given "column" must all have the same meaning
]

In a NoSQL database, no such rules apply. Rows can have any number of elements and hold any kind of data. This means that "column headers" will be different for each row, as well. Note that this is a general rule of thumb for NoSQL databases, but there are many different kinds of data storage mechanisms for NoSQL.

In general, NoSQL is more flexible than SQL and the particular "flavor" of NoSQL database that you need is dependent on the constraints of your problem. NoSQL can be faster than regular SQL for a particular problem set, but generally it is seen as slower and more error prone, due to the (small) possibility of "stale reads" (where data that is scheduled to be updated has not yet been updated when the user reads that data).

Collapse
 
lmolivera profile image
Lucas Olivera

A very clear answer, thank you very much.

Collapse
 
georgecoldham profile image
George

Second sentence, did you mean SQL instead of NoSQL?

Collapse
 
awwsmm profile image
Andrew (he/him)

Oof, yes. It's early haha. Fixed