Learning pathsPricingChecking sign-in…
GUIDED PRACTICE

PostgreSQL, DynamoDB and Cassandra

Relational, key-value and wide-column databases optimize different query and consistency models; compare them using concrete access patterns.

PostgreSQL, DynamoDB and Cassandra

Relational, key-value and wide-column databases optimize different query and consistency models; compare them using concrete access patterns. PostgreSQL offers relational constraints, joins, transactions, MVCC and flexible indexed queries. DynamoDB uses partition/sort keys and access patterns designed up front; GSIs create alternate query paths. Cassandra distributes partitioned rows and favors query-first denormalized tables with tunable consistency.

Mechanism and worked example

An order system with multi-row invariants and reporting may fit PostgreSQL. High-volume user activity by user_id and time may fit DynamoDB. A globally distributed time-series workload with known partition queries may fit Cassandra if hot partitions, tombstones and repair are managed.

QuestionPostgreSQLDynamoDBCassandra
TransactionsRich relationalACID transaction within documented limitsPartition-scoped lightweight transactions
QueriesFlexible SQL/indexesKey patterns and GSIsPartition-key-first
ScalingVertical, replicas, partitionsManaged partitioned throughputDistributed ring/replication
OperationsVacuum, locks, WALHot keys, capacity, indexesCompaction, tombstones, repair

Failure modes and operations

PostgreSQL can hit connection, lock, vacuum or write scaling limits. DynamoDB can throttle hot keys or amplify GSI writes. Cassandra can suffer tombstone-heavy reads, compaction debt, repair lag and queries missing partition keys.

Trade-offs and design boundary

PostgreSQL reduces application-side coordination for relational invariants but needs careful connection/write scaling. DynamoDB offers managed partitioned throughput but requires access-pattern discipline. Cassandra offers distributed write scale with consistency and operations complexity.

Interview transfer exercise

For a wallet transfer, identify the atomic debit/credit invariant and choose a transaction boundary. A key-value store can support it only with explicit conditional/transaction semantics and a clear cross-account boundary.

Diagram: List invariants and query shapes; Map keys, indexes and transaction boundaries; Estimate skew, throughput and retention; Choose engine and recovery operations
Mechanism and decision flow for PostgreSQL, DynamoDB and Cassandra.
Read the diagram

List invariants and query shapes → Map keys, indexes and transaction boundaries → Estimate skew, throughput and retention → Choose engine and recovery operations

Open original
PostgreSQL, DynamoDB and Cassandra
Diagram: List invariants and query shapes; Map keys, indexes and transaction boundaries; Estimate skew, throughput and retention; Choose engine and recovery operations

Mechanism and decision flow for PostgreSQL, DynamoDB and Cassandra.

18:00Self-guided practice timer
The timer resets when you leave this page. Save your design separately.
Your challenge

For a wallet transfer, identify the atomic debit/credit invariant and choose a transaction boundary. A key-value store can support it only with explicit conditional/transaction semantics and a clear cross-account boundary.

Your design draft

Clarify assumptions, explain your approach, and test the difficult cases. Save your draft, then compare it with the study notes.

Read study notes

Self-review checklist

Self-guided practice. Automated AI feedback and code execution are not connected.