Separate the database (and pick SQL or NoSQL)
Play this lessonThis lesson comes with an interactive animation you can break, a live-code challenge and a chapter quiz.As users grow, one box is not enough. We split it into two: a web tier (handles web and mobile traffic) and a data tier (the database). Each can now be scaled independently.
Which database?
🗃️ Relational (SQL)
- MySQL, PostgreSQL, Oracle
- Tables and rows
- JOINs across tables
- 40+ years of proven reliability
📦 Non-relational (NoSQL)
- Cassandra, DynamoDB, CouchDB, HBase, Neo4j
- 4 families: key-value, document, column, graph
- JOINs usually not supported
For most developers a relational database is the right default. Consider NoSQL when:
- you need super-low latency,
- your data is unstructured or has no real relationships,
- you only need to serialize/deserialize data (JSON, XML, YAML),
- you need to store a massive amount of data.
Key takeaways
- Web tier and data tier scale independently.
- SQL is the safe default; NoSQL is for special needs: low latency, huge or unstructured data.