AWS re:Invent 2017: [REPEAT] Advanced Design Patterns for Amazon DynamoDB (DAT403-R)
Why Stack Overflow recommends it
Stack Overflow users link it when answering DynamoDB schema questions, such as modeling many-to-many relationships, forums without hot partitions, and aggregate stats, because it walks through real single-table designs.
Recommended by 3 people across 3 different months, 2018 to 2020.
What it is
A 49-minute AWS re:Invent 2017 session on advanced DynamoDB data modeling, given for people who already know the basics. It covers GSI sharding, index overloading, materialized aggregation queries, adjacency lists for graph data, composite keys for relational modeling and transactional workflows, drawing on patterns used inside Amazon.
What people said
Recommends Mike · 2018-06 · Stack Overflow · on “DynamoDB adjacency list primary key”
I am completing an exercise using DynamoDB to model a many to many relationship. I need to allow a many to many relationship between posts and tags. Each post can have many tags and each tag can have many posts. I have a primary key on id and primary sort key on type and then another global index on id and data , I added another global index on id and type again but I think this is redundant. Here is what I have so far. id(Partition key) type(Sort Key) target data ------------- ---------- ------ ------ 1 post 1 cool post tag tag tag n/a 1 tag tag orange --------------------------------------------- ---- inserting another tag will overwrite --- --------------------------------------------- 1
Recommends Xeoncross · 2019-03 · Stack Overflow · on “How to model a forum using Amazon DynamoDB without hot-partitions?”
The AWS DynamoDB documentation includes an example schema for a forum [LINK] . However, the number of questions this schema is able to answer seems very small. In addition, the table seems to suffer from a hot-key problem (a burst of replies backs up on the same partition). In a talk title "Advanced Design Patterns for Amazon DynamoDB" the presenter around 43 minutes breaks down [this video] a complex use-case from Audible using only a single table with 3 GSI (indexes). I'm trying to learn proper DynamoDB modeling coming from a standard RDBMS 3NF background. How would a forum be designed to prevent hot-partitions while still meeting these common use-cases? Queries: Topics by Forum (sorted by date
Recommends Charles · 2019-11 · Stack Overflow · on “Aggregation stats on Dynamodb Table”
Have you looked at Using Global Secondary Indexes for Materialized Aggregation Queries [LINK] You seem to have a textbook use-case for Streams + lambda function to calculate and update the aggregate counts. If I recall correctly, the AWS reInvent video Advanced Design Patterns for Amazon DynamoDB [this video] goes into some more detail including the "Top 10" functionality.
Cites Mike · 2018-06 · Stack Overflow · on “DynamoDB adjacency list primary key”
I am going by this diagram [this video] It seems like I would need the id to be 1 for the sports tag in order to know what post that is attached to.
Cites Horatiu Jeflea · 2020-02 · Stack Overflow · on “How to store trip itinerary data into DynamoDB?”
Regarding the data structure, I don't see an absolute need for DayTrip , as you can get all that data from Itinerary . So in UserTrip I would keep a list of Itineraries instead of a list of DayTrips. It wouldn't be good to store the UserTrip as is, with nested JSON structure consisting of DayTrip, then Itinerary, right? It would mean that the subTrip attribute of a particular UserTrip will be a huge chuck of JSON. So I think everyone here would agree this is a no, no. Is that correct? Actually this is recommended in NoSQL databases [this video] , to have all data denormalised/embedded in the object. You use more storage, but avoid joins/processing. But keep in mind DynamoDB's item size limitation