DynamoDB interview question · Most asked
What are global tables, and what consistency do they provide?
Summary
Global tables replicate a table across AWS Regions with every replica accepting reads and writes (multi-active). By default replication is asynchronous, typically within a second or so, and concurrent writes to the same item are resolved by last writer wins. AWS also offers a multi-Region strong consistency mode for global tables with different trade-offs.
Longer Answer
Use cases: low-latency access for users worldwide and Regional disaster recovery. Design implications for the default mode: avoid writing the same item in several Regions at once (route each user's writes to a home Region), make operations commutative or idempotent, and accept that a read in another Region may briefly be stale. Conditional writes and transactions are evaluated only in the Region where they run.
Key Points
- Multi-Region, multi-active replicas.
- Asynchronous by default, last writer wins.
- Route an item's writes to one Region.
- Multi-Region strong consistency option exists.
More most-asked DynamoDB questions
- What are DynamoDB Streams, and how are they used?
- Query or Scan: what is the difference, and why avoid Scan?
- What is DynamoDB, and what workloads is it a good fit for?
- What is a hot partition, and how do you avoid one?
- How do you approach data modelling in DynamoDB, and how is it different from relational design?
- Explain partition keys, sort keys and the two kinds of primary key.
- Global secondary index or local secondary index: what is the difference?
- How do conditional writes work, and how do you implement optimistic locking in DynamoDB?