A key gives one predictable access path#
session:abc123 → { userId: 42, expiresAt: "..." }
flags:user:42 → { checkoutV2: true }When the application knows the complete key, lookup can be simple and easy to partition conceptually. Sessions, preferences, feature flags, counters, and direct lookup tables often fit this shape.
The second query changes the model#
“Fetch session by token” is direct. “Find every session for this user ordered by last activity” needs another key structure, an index, or a different store. Value size, atomic operation scope, expiry, partition key distribution, and hot keys still matter.
DynamoDB and Redis are examples used for key-oriented patterns, but their durability, query, transaction, and memory/storage behavior differ. Product names do not replace requirements.
Related practice problems
Use the manifest-backed prompts below to apply this lesson in a complete design.
- DynamoDB data-modeling best practicesAWS Documentation