DynamoDB 00:00:01 Find a customer's last order A shopper can remember her account but not her order number. In DynamoDB the fastest route through this design begins with the partition key, and the sort key distinguishes records that belong together. Picture one item collection per user. Items sharing the user's partition key are ordered by their sort key. USER#2 is hashed and the router knows its partition. The other rows are never touched. The sort key PROFILE gives one item. The query restricts the sort key to order entries and reads them in reverse order with a limit of one. For the last-order lookup to work, the order suffix must sort by the intended chronology. A key design encodes which questions can be answered without searching unrelated items. 00:00:50 A confirmed order disappears from a list Order seven has just been accepted. The customer opens a secondary view organized by status. Can a successful base-table write and an empty search result both be correct? The table has it and says success. The customer opens the list. It is read from the index, and order 7 is missing. A moment later the index has it. Show the order just written from the table, and the older ones from the index. Global secondary indexes are eventually consistent. A purchase-confirmation experience can show the acknowledged order directly and let the index catch up for browsing. 00:01:32 Two customers claim a link Asha and Lee both want the same short link. Reading first and writing later leaves a gap in which both may think they won. Put the precondition on the actual write. Asha and Lee want my-link in the same moment. Asha's conditional put succeeds because the key does not yet exist when the service evaluates the operation. Now the link exists, so the condition is false and nothing is written. The loser receives a conditional failure and can choose another name. A second question about who won can now be answered from the stored item instead of two conflicting success screens. 00:02:12 Take the heat off one leaderboard key Now a live game sends every score update to one busy logical key. The numbers here are a capacity exercise for small writes with the assumed partition budget. Demand reaches twenty-four hundred writes per second against a single hot range. In this example the available write budget is only one thousand units per second. Divide the game's writes among three key suffixes. With a balanced assignment, each receives about eight hundred writes per second. Read the top ten candidates from each shard and merge thirty candidates to produce the final ten. Write sharding trades a concentrated write path for extra read work. Choose the number of shards from measured traffic, item sizes and the top-list query you need to assemble. 00:03:01 A cart is expired before it vanishes A cart comes with a seven-day expiry time. The buyer checks it on day eight. Expiry here has two meanings: the business rule for the shopper and a background cleanup mechanism. Store the expiration timestamp on the item. Seven days in this example is six hundred four thousand eight hundred seconds. The time has passed but the item is still there. A read returns it. The app compares the time and treats it as gone. DynamoDB's TTL process can remove the expired item later. In the originating region, that TTL deletion does not consume a normal write-capacity unit. Make the business decision when serving the read. The customer's experience no longer depends on exactly when the background deletion reaches this item.