I want to know what is the best approach to works with one-to-many relations in DynamoDB. Let's assume that I have a post
and category
tables. The category
table has id
and name
columns. The post
table has id
, title
, and category_id
columns. With a relational database, I would use join between the two tables. I know that I can't join two tables in DynamoDB. When I present several articles summaries with the category in a page, I know that with a RDBMS I don't need to run a query each time I want to fetch the category name.
I've seen many examples where the category name is embedded as the name and not the ID, so I can just read the document, and I have all the information with a single query. The problem is that when I want to change the category name with DynamoDB I need to run a scan query to update the column—I don't want to do that. I thought about using category_id
and use caching in order to not repeating the category name query when paginating. Any good modeling technique how to solve this issue with DynamoDB?