INITIALIZING SECURE CHANNEL...
CPU MEM NET PING9.2 ms SECSECURED
COFFEE—WEB v4.0 // eu-1
ONLINE 2 847 --:--:--
/english > 31. Database Design & Trade-offs
// УРОК 31

Database Design & Trade-offs

B2

Database Design & Trade-offs

CAP Theorem

In a distributed system, you can only guarantee two of three:

  • Consistency — all nodes see the same data at the same time
  • Availability — every request gets a response
  • Partition tolerance — system works despite network partitions

Choosing a Database

Use CaseRecommendationReason
Complex relationships, ACIDPostgreSQLRelational integrity, transactions
Flexible schema, scale-outMongoDBDocument model, horizontal sharding
High-speed cachingRedisIn-memory, sub-millisecond latency
Time-series dataInfluxDB / TimescaleDBOptimized for append, range queries
Graph relationshipsNeo4jNative graph traversal

Useful Phrases

  • "For this use case, I would choose PostgreSQL because we need ACID transactions."
  • "The trade-off with MongoDB is that joins become application-level, not database-level."
// TERMINAL CHALLENGE

Проверь себя

Q1. What does ACID stand for in database transactions?
Q2. According to the CAP theorem, a distributed system can guarantee at most how many properties simultaneously?
Q3. Which database is best for caching frequently accessed data with sub-millisecond latency?
Q4. Complete: 'For this use case I would choose PostgreSQL because we need ACID ___.'
Q5. What is the main trade-off when choosing MongoDB over PostgreSQL?
╔═ GL1TCH v0.1 ═[ПОДКЛЮЧЕНО]═╗ [×]
СОЕДИНЕНИЕ АКТИВНО
запросов:
// сессия #{} начата
>_
[ РАЗРЫВ СВЯЗИ ]
лимит исчерпан...
иду спать... zzZ
хочешь больше? [зарегистрироваться] // +10 запросов в день