Blog
Thoughts on engineering, design, and building great products.
Global Secondary Index and Sparse Index: Opening a New Query Path
The single-table from the previous article answers 'open a link by code' fast, but is helpless at 'list a user's links'. This article adds a global secondary index to invert the key and open exactly that query path, then uses a sparse index so the index holds only links and naturally drops the stat records. Create a real GSI, run a real query to see the mechanics.
DynamoDB Single-Table Design: Start From the Questions, Not the Table
DynamoDB design runs opposite to a relational database: you start from the query questions, not from tables. This article lists the URL shortener's access patterns, explains what partition key and sort key actually do, then builds a single-table with an item collection — a link and its click stats live in the same partition and come back in one query. Create a real table, put and query real items to see the mechanics.