Skip to content
StackDecode
System Design
4. Database FundamentalsAnimated

Relational Databases

Data stored in tables of rows and columns linked by keys.

The idea

Relational databases enforce a schema, support joins and give strong transactional guarantees (ACID).

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

App serversPrimary (writes)Replica 1 (read…Replica 2 (read…
  • client
  • gateway / proxy
  • service
  • cache
  • data store
  • queue / stream

Step one: add indexes and cache.

step:
1/4
at:
App servers
1/7

The green dot is a request moving through the system.

Step by step

  1. 1Define tables and relationships
  2. 2Insert rows that obey constraints
  3. 3Query with SQL and joins
  4. 4Transactions keep data consistent

Where it is used

Orders, payments, accounts.

Watch out for

Scaling writes beyond one machine is hard.

Related