Amazon DynamoDB (50 Qs)•Part 3: Advanced Architecture, Scale & Internals (Senior / Lead)
Primary Key Architecture: Partition Key (Hash) vs Composite Primary Key.
senior LevelSystem Design
In Simple Words: Every DynamoDB item is uniquely identified by its Primary Key:
- Simple Primary Key (Partition Key only): Items are distributed across physical storage partitions using an internal hash function
MD5(PK). Lookups are exact equality matches (PK = "user_123"). - Composite Primary Key (Partition Key + Sort Key):
PKdetermines the physical partition;SKdetermines physical sort order within that partition. Enables rich range queries:begins_with(SK, "ORDER#2026")SK BETWEEN "2026-01-01" AND "2026-11-20"SK > "100"