DynamoDb Flashcards
What is strong consistency read? (Dynamo DB)
This is compared to an “Eventually Consistent Read”. Strong means it will return the last write’s value where eventually might include stale data.
What are the downsides of using “Strong Consistent Reads”?
Higher latency
Not supported on global secondary indexes
Use the most throughput capacity.
What do DynamoDb streams do?
They capture time ordered changes to items in db tables.
What is Dynamo Time To Live (TTL)?
Defines a per item time stamp that determines when an item can be deleted.
Scenarios:
Delete user info if there account is dormant for so long.
Keep data back up per regulatory requirements, then delete after expires.
This is a free feature.
What is Dynamo Accelerator (DAX)?
A managed in memory cache that sits in front of DynamoDB.
What are RCU’s?
Read Capacity Unit.
1 RCU can read up to 4k item, “strong consistency read” every second.
What are WCU’s
Write Capacity Unit.
1 WCU can write up to 1k item every second.
Example: a 2k item would require 2 WCU every second.
What is a projection expression?
It is a string (aka like a query) that defines the attributes that you are trying to retrieve.
What is the difference between a query, scan, getItem, and, batchGetItem ?
A scan is looking at every record to determine which results to return (does not care about keys). Can only return 1MB of data back at a time (works like ). Don’t use scan! big bills and performance problems.
Query is specific partition that relates to primary and secondary partition keys (think C# dictionary). So this is a very efficient lookup. Always try and design your db’s to use Query.
What is ProvisionedThroughputExceededError?
You get this when your request rate is to high. Interesting is that the underlying SDK will retry and eventually succeed when this error is received.
What is the difference between batchGetItem and a query?
A query uses the partition key and optionally a scan key, and can then optionally filter further by filterExpression. This query is also limited to a partition.
batchGetItem retrieves items by primary key. You have to know the entire primary key. There are two types of primary keys:
- Partition key
- Partition key, sort key (composite key)
What is a local secondary index?
Provides an alternative sort key. Must be created at table creation time. Can create up to 5 per table. Uses the same partition key. so it provides you a different view of your data.
What is a global secondary index?
Uses a different partition key.
Creates a new table using the new partition key but keeps the two tables in sync.
This separate table needs to be administered just like your original table (WCU/RCU configured, throttling , ect.. )
What problems could a GSI have?
Doubles WCU, aka writes to the original table needs to be propagated this table.
Your GSI could return stale data.