Dynamo DB
NoSQL vs Relational
NoSQL:
- No Relations
- High Flexibiliy
- Data Repetition
- No integrity checks
- Easy Scalability
Relations:
- Relations
- Limited Flexibiliy (Strong Schemas)
- No Data Reletition
- Integrity Checks
- Harder Scalability
Need to manage the servers and clusters for relations.
How it works:
- NoSql Database
- No Relations
Data Format:
- Key/Value Pair
- No schema
Key, Attributes, Indexes:
Always required: Partition Key
- Has to be unique and be present on each item
Eg:
Partition Key: UserId
Attribute: FirstName
Why is it name Partition Key?
How Dynamo store the data, uses fleet of SSD, does this by partioning the state drive
Simple example: Store them from A B C ...to Z
If your userId starts with A1, A2, A3, it will get stored in A partition
Sort Key
Partition and a Sort Key as a Primary Key
Both don't have to be unique, but but when combined they are eg: UserId + timestamp
Query Data
When you need to query other attribute eg: FirstName
Global Secondary Index
For that you will need to set up a 'Global Secondary Index' (5 per table), this forces AWS to manage this attribute in an optinal way, when querying makes it more efficient.
Local Secondary Index
Provision Capacity
How often do you read/write this data, but also the size of item you are reading/writing
What about multiple databases?
You can only create table per regions