- Make users easy to query data by joining the tables.
- Inner join: Returns records that have matching values in both tables.
- Outer join: Returns all records when there is a match in either left or right table.
- Left join: Returns all records from the left table, and the matched records from the right table.
- Right join: Returns all records from the right table, and the matched records from the left table.
- Related Reference: SQL Joins
- Relational databases
(1) Relational databases are also called arelational database management system (RDBMS) or SQL database
.
(2) The most popular ones are MySQL, Oracle database, PostgreSQL, etc.
(3) Relational databases represent and store data in tables and rows. You can perform join operations using SQL across different database tables.
- Non-Relational databases
(1) Non-Relational databases are also calledNoSQL databases
.
(2) Popular ones are CouchDB, Neo4j, Cassandra, HBase, Amazon DynamoDB, etc.
(3) Join operations are generally not supported in non-relational databases.
- Your application requires super-low latency.
- Your data are unstructured, or you do not have any relational data.
- You only need to serialize and deserialize data (JSON, XML, YAML, etc.).
- You need to store a massive amount of data.
- Vertical scaling
(1) Referred to asscale up
.
(2) Can add more power (CPU, RAM etc.) to the existing servers, but there are hardware limits.
(3) Greater risk ofsingle point of failures (SPOF)
.
(4) The overall cost is high.
- Horizontal scaling
(1) Referred to asscale out
, also known assharding
.
(2) It allows you to scale by adding more servers into your pool of resources.
- Horizontal partition (Sharding): Meaning the database table is split up by drawing a horizontal line between rows.
- Vertical partition: Where partitions are made between columns.
- Related Reference: Sharding
- If a system fails which will stop entire system from working.
- The CAP Theorem for distributed computing was published by Eric Brewer. This states that it is not possible for a distributed computer system to simultaneously provide all three of the following guarantees:
(1) Consistency: all nodes see the same data even at the same time with concurrent updates)
(2) Availability: a guarantee that every request receives a response about whether it was successful or failed)
(3) Partition tolerance: the system continues to operate despite arbitrary message loss or failure of part of the system)
- Index is created by using a few database columns.
- An index is used to speed up searching for a specific column in the database.