The more I watch Rick's sessions from 2017, 2018 and 2019, more confused I get - so I guess I'd write it down.
There are 3 core steps (some have more, I want to stick to 3) to create a decent model that works well:
- Understand the usecase + create ERD(list entities and relations)
- Identify the access patterns - R/W workloads, query dimensions and aggregations
- Data modeling - avoid relational patterns, use 1 table(if there aren't any "documents", 1 should be fine)
- R.R.R = Review > Repeat > Review (go on till it makes sense)
Dapier / Admino = DB viewer (like Adminer / phpMyAdmin/pgAdmin etc) but running online (obviously it would work if the DB connection is allowed to connect from non-local clients) - anyway, that's not these notes are about.
These notes are about creating the table structure in DynamoDB.
The very first odd thing I noticed when I first logged in to DynamoDB web UI was that there is no option to "Create Database" - there is an option to "Create Table", and this bothered me. I was like "Why wouldn't you have a 'Database'?, How would I 'categorise' my tables?".
And the next thing I start reading is that you should have "One" (1) table - this is when I stopped fighting my own thoughts.
If 90% of the services of AWS/Amazon are using DynamoDB, and it is running pretty fast, then there must be some sense in what is being said.
The reason for NOT having Database is due to the fact that the DynamoDB mindset would want to keep a single table, unless a unique edge-case shows up and requires a separate "table". One such example is that if documents are stored in the table (say 10 MB per row, for say 10% of the matched records), then it would break/cross the limit on data that could be read from the DB in a single request. In such a scenario, the "hash" (akin to primary-key) would be saved in DB, and there could be (could be not) a chance to store reference of this primary-key in another table as FK (though it could still be done in the same table).