- Newest
- Most votes
- Most comments
The application layer manages it, that's often the case with NoSQL and DynamoDB specially.
The point of DynamoDB is to use extra storage space but gaining speed, because storage is cheaper than processing power.
Yes, you should concatenate the data in your application to create the composite sort key. The primary key should be selected based on your access patterns so that you retrieve the required result set as efficiently as possible by avoiding unnecessary round trips to the database. This means that you will duplicate (and de-normalize) some of the data to gain the efficiencies in speed and performance. The datamodel you pick depends entirely on your application access patterns and business requirements. This NoSQL best practice is documented here: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-general-nosql-design.html#bp-general-nosql-design-concepts
That said, there are a few ways to lower your storage costs although the effort is greater than the benefit. I would encourage you to weigh the overall application requirements before finalizing your approach. For example, you can store the concatenated data values in the sort key only and not store them as individual attributes. The tradeoff would be to parse the sort key in your application if you require it. Also, you can store abbreviations for the data values. For example, you may have a “status” attribute with values [Success, Failure, In Progress]. You can represent this data set as [S,F,I] and use a config file to match the values on the fly using your application.
Relevant content
- asked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 months ago