All SQL databases use tables for data storage and use SQL as a query language. They are great for transactions, complex queries and integrity.
The most common examples are PostgresQL, MySQL, SQLite, etc.
A
tomicity: transactions are all or nothingC
onsistency: after a transaction your database should be in a consistent stateI
solation: each transaction should be independentD
urability: once a transaction is commited the data is there to stayThese databases drop the Consistency
property from the ACID
.
No schemas, good for unstructured data.
There are different types of NoSQL databases:
Key-Value Pairs
Document-based
Graph-based
In-memory
The most common examples are MongoDB, Cassandra, Redis, etc.
Can be Relational or NoSQL depending on their design and structure.
Consists of distributing different portions (shards) of the dataset across multiple servers.
Some of the sharding strategies are:
Range-based Sharding
: based on the range of a given keyDirectory-based Sharding
: Lookup service to direct traffic to the correct nodeGeographical Sharding
: Based on geographic locationKeeping copy of data in multiple servers for high availability.
Master-Slave replication
: strategy where slave instances are only used for READ operationsMaster-Master replication
: all instances can do WRITE and READ operationsSome of the most common techniques to optimize performance are:
Caching
: In-memory caching is usually used for frequently accessed dataIndexing
: Creating an index for frequently accessed columns will significantly speed up retrieval timesQuery Optimization
: Optimizing queries for fast data access. i.e. minimizing JOIN
s and using tools to understand query performance.