- Newest
- Most votes
- Most comments
Hi Tarek,
This is a perfect candidate for something known as single table design. With single table design, you can set up a Partition Key and Sort Key with the names PK and SK respectively. The PK and SK make up the composite primary key.
Inside the PK and SK, you can define the data as follows:
PK
KEY#keyvalue
KEY#aaaa
KEY#bbb
SK
SORTKEY#sortkeyvalue
SORTKEY#sortaaaa
SORTKEY#sortbbb
In fact, you can even define the data as follows in these keys: KEY#keyvalue#SECONDKEY#secondkeyvalue.
This is a difficult concept to explain this brief post. Instead, I recommend that you review: https://explore.skillbuilder.aws/learn/public/learning_plan/view/1840/amazon-dynamodb-learning-plan
The section "Architecting Applications and Tables for DynamoDB" inside of "Developing with DynamoDB" covers single table design.
Here's an article that also describes this approach: https://aws.amazon.com/blogs/compute/creating-a-single-table-design-with-amazon-dynamodb/
Hope this helps. If it does, please accept this answer and give it a thumbs up.
Relevant content
- asked 7 years ago
- asked 2 years ago
- asked 3 days ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 2 years ago
Hi Bryant, I did evaluate the single table design but it requires several reads in order to get the full image to avoid data duplication, one for the relationship and another for the related data. my goal is to perform a single atomic operation while looking up an item by a relationship key.