Member-only story
SQL vs. NoSQL Databases & Properties
NoSql databases have been increasing in popularity, so let’s layout the differences between SQL and NoSql, and why you would choose one database type over the other.
SQL characteristics (ie: PostgreSql)
DB contains tables with rows
static schema, fixed data types
add/ delete fields updates all rows
has foreign keys to set relationships
supports ACID transactions
normalized to reduce redundancy
DB scales vertically (more resources)
NoSql characteristics (ie: MongoDB)
DB contains collections with documents
dynamic schema, dissimilar data types
can add/ remove fields dynamically
documents can embed other documents
supports atomic operations for single docs
denormalized to increase read speeds
DB scales horizontally (uses more servers)
Choosing Database Type:
Choose SQL if the data needs ACID properties, data reads/ writes require transactions, data needs to be aggregated or analyzed, or types of data (columns) are mostly static.
Choose NoSQL if data needs to scale easily, eventual data consistency is ok, or the types of data (columns) change often.