Patterns
The following patterns were chosen following the best DynamoDB practices and with the business needs in mind. Some are for standardization among all the application
- Attribute names have no relationship to attribute values.
- Store date-like data as integers, for easy comparison.
- Automatic UUID generation for ids. When the attribute must have an id (this is not applicable to available_groups since it is a simple string value), it should be an uuid4.
- According to
official documentation
the latency of a
get_item
vs aquery limit=1
will be equivalent. So it is better to have always both range and sort key for every table and GSI. - Use hierarchical relationships: group attributes will have an attribute, which is a sort key, with the following structure: ORG_ID#TYPE#STATUS. With this, it is easy to search for groups within a company, with a certain type in a given status, and everything in between, since a sort key can be searched partially.
Calculations for
write sharding
:
For groups. Get active and suspended groups. This query is important for forces executions:
Given the latter, there is no need to write sharding in groups items
For findings.
- NoSQL Design
- Partition Key Design
- Sort Key Design
- Secondary Indexes
- Many-to-Many Relationships
- Relational Modeling