Amazon DynamoDB supports several more advanced key/value operations:
- Batch Operations
- Atomic Counters
- Conditional Writes
- Time To Live
These are important as Conditional Writes could be used for acquiring locks allowing a single instance to work on some data in a more race-safe way.
- https://www.slideshare.net/AmazonWebServices/design-patterns-using-amazon-dynamodb
- Advanced Design Patterns for Amazon DynamoDB (2917): https://www.youtube.com/watch?v=jzeKPKpucS0
- Around 43 minutes he breaks down a complex usecase from Audible using only a single table with 3 GSI (indexes).
- 2018 version: https://www.youtube.com/watch?time_continue=1&v=HaEPXoXVf2k
- with updated example: https://youtu.be/HaEPXoXVf2k?t=2601
- Using DAX infront of DynamoDB to transparently handle caching: https://www.youtube.com/watch?v=sphOT_e4WJ8
- Modeling Relational Data in DynamoDB
- Example tables and data
- https://www.trek10.com/blog/dynamodb-single-table-relational-modeling/
- https://www.dynamodbguide.com/
- https://blog.runscope.com/posts/migrating-to-dynamodb-part-1-lessons-in-schema-design
- https://medium.com/signiant-engineering/using-dynamodb-transactions-to-model-relational-data-c13619ca58ae
Using primary, secondary, and data keys in unique (and sometimes repeating) ways you can work complex relationships into simple tables.
- STATIC string / sparse index:
- 'PRDOUCT' + 'discontinued' lets us find all discontinued products easily
- 'ORDER' + DATE lets us find all orders of a certain date
- Write Sharding:
- Append a random value to the end of the PK to partition writes
- Append a known value to the end of the PK % module + 1
- hierarchical sort key
- Combine multiple values into a single key. This :
COUNTRY##STATE##CITY
orGUID + _ + DATE
- Use range queries with operators such as starts-with, between, >, <, and so on.
- Combine multiple values into a single key. This :
Reddit uses PostgreSQL as a glorified k/v store with two tables: Things and their Data Properties: https://www.infoq.com/presentations/reddit-architecture-evolution
This idea of a forum is repeated with the AWS sample forum webapp: Java + Angular Forum. You can see a basic schema here: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/SampleData.CreateTables.html#SampleData.CreateTables2