DynamoDB Flashcards
Define Eventual Consistent Reads
Consistency across all copies of data is usually reached within a second.
Define Strongly Consistent Reads
A read that results in all writes that were successful prior to the read
DynamoDB tables are composed of ___________ and _____________.
Items (rows) and Attributes (data)
What are the two types of primary keys available?
Single attribute - Partition Key
Composite - Partition and Sort Key
True or False: Single attribute primary keys can be shared between items
False
How is the partition key used by DynamoDB?
The partition key is hashed to determine the partition the data is stored in.
True or False: Items with a composite primary key can share partition keys.
True. They must have a different sort key
Local Secondary Index has the ________ partition key and ________ sort key.
Same.
Different.
Global Secondary Index has the ________ partition key and ________ sort key.
Different.
Different.
When can a Local Secondary Index be created?
Only at table creation.
Can a Local Secondary Index be modified or removed?
No.
When can a Global Secondary Index be created?
At table creation or added later.
What are DynamoDB Streams?
They capture any modifications to the DynamoDB table.
What is the difference between Query and Scan in DynamoDB?
Query finds items by primary key attribute values. A scan examines every item in the table.
Which is more effecient: Query or Scan?
Use query operations.
How is read and write throughput measured in DynamoDB?
Capacity units
One write capacity unit is equal to _______ write of ________ KB.
one
1KB.
One read capacity unit for eventual read consistency is equal to _____ read(s) of ______ KB per second
two.
4KB.
One read capacity unit for strong read consistency is equal to _____ read(s) of ______ KB per second
one.
4KB.
An application needs to read an item that is 13KB in size 20 times per second with eventual consistent reads. What should the read capacity be set to?
Calculate the read capacity units. Multiply by throughput. Divide by two for eventually consistent reads.
13 rounded up to nearest multiple of 4 = 16
16KB / 4KB = 4
4 * 20 = 80
80 / 2 = 40
An application needs to write an item that is 12.5KB in size 30 times per second. What should the write capacity be set to?
Calculate the write capacity units required. Multiply by throughput.
12.5KB / 1KB = 13 (round up)
13 * 30 = 390
What error codes would be seen if you go over provisioned throughput?
HTTP status 400: ProvisionedThroughputExceededException
What is a conditional write?
Idempotent transaction. Duplicate requests will not be processed
True or False: Atomic counters are idempotent.
False. the counter increments every time you call UpdateItem
What API call should you use to read multiple items?
BatchGetItem
How many items can be retrieved by a BatchGetItem API call?
Up to 100 and 16MB in size.
True or False: BatchGetItem can retrieve items from multiple tables.
True
What is DynamoDB?
fully managed NoSQL database
What is the limit size of an item?
The total size of an item, including attribute names and attribute values, cannot exceed 400KB.
What is the response limit for a Query API call?
1MB
What data types does DynamoDB support?
Number, String, Binary, Boolean. Collection: Number, String, Binary, List, Map
True or False. DynamoDB has a 5PB storage limit.
False
What application patterns work best with DynamoDB autoscaling?
Uniform and predictable with sustained high/low throughput usage.
What is a global secondary index?
An index that contain a partition or partition-and-sort key that can be different from the table’s primary key.
What is the difference between a local and global secondary index?
A local index has the same partition key as the table but a different sort key. It is scoped to the table partition that has the same partition key.
A global index can be different from those on the table. Queries can span all items in a table across all partitions
When should you use a global secondary index?
If you need to track a relationship between values that have a lot of different values.
True or False: Global Secondary Index keys must be unique.
False
What is the consistency model for a Global Secondary Index?
Eventual consistency
True or False: A Global Secondary Index must be provisioned for its own read and write capacity.
True
Can a Local Secondary Index be deleted?
No
True or False: A Local Secondary Index must be provisioned for its own read and write capacity.
False
What data types can be indexed?
All scalar types. Number, String, Binary
What are item collections?
A group of items that share the same partition key across a table and all of its local secondary indexes. Traditionally called shards or partitions.
True or False: Item Collections must be created manually
False.
Is there a limit size for an Item Collection?
Yes. 10GB
What is Reserved Capacity?
A billing feature that allows you to obtain discounts on provisioned throughput.
What is the smallest amount of reserved capacity that can be purchased?
100 capacity units