DynamoDB Flashcards

1
Q

Describe DynamoDB

A
  • Managed, multi-AZ NoSQL data store with Cross-Region Replication option.
  • Defaults to eventual consistency reads but can request strongly consistent read via SDK parameter.
  • Priced on throughput, rather than compute.
  • Provision read and write capacity in anticipation of need.
  • Autoscale capacity adjusts per configured min/max levels.
  • On-Demand Capacity for flexible capacity at a small premium cost.
  • Archieve ACID compliance with DynamoDB Transactions.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Relational vs NoSQL

A

Relational: Structured Data needed.
NoSQL: Manages Name-Value pairs, non-structured data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the structural objects in a NoSQL database?

A

Name: Identifier of the Name-Value pair.
Value: Content of the Name-Value pair.
Attribute: Another name for the Name-Value pair.
Item: Whole collection of Name and Values.
Table: Many item records come together to form a table.
Primary Key: An Attribute in an item that is unique and identifies the record.
Hash Attribute/Internal Hash: Maps a data value of arbitrary size to fixed size. Is used to decide which partition or underlying physical storage to store this value. Can also be called a Hash Attribute.
Composite Primary Key: An alternate identification method for Items/Records where a Partition Key and Sort Key are used.
Partition Key: A Primary Key that can have occurrences of the same Partition Key as long as the Sort Key is different. The same hashes are done to the partition key, but the records are stored in the sort order of the sort key. Useful if you want to pullback a subset of data on some Sort Key.
Sort Key: Identifies a sort order and helps in improving performance through indexing and subsetting of data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Name the two types of indexes

A

Global Secondary Index: Partition key and a sort key can be different from those on the table.
Local Secondary Index: Same partition key as the table, but different sort key.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

When would you use a Global Secondary Index

A

When you want a fast query of attributes outside the primary key without having to do a table scan (read everything sequentially).
“I’d like to query Sales Orders by Customer number rather than Sales Order Number.”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

When would you use a Local Secondary Index

A

When you already know the partition key and want to quickly query on the other attribute.
“I have the Sales Order Number, but I’d like to retrieve only those records with a certain Material Number.”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Design Best Practices

A
  • Partition Keys are the same, but Sort Key Values are all different (Sort Key Name is the same).
  • Leverage Sparse Indexes - Indexes can exists only for certain attributes that don’t always exist in every record (smaller, more efficient indexes).
  • Can use a Global Secondary Index to create table replicas. You just have to use the same Partition Key and Sort Key. You can differentiate performance by table, or you can use the GSI as a read replica. Replica is Eventually Consistent
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

If you need to access just a few attributes the fastest way possible, consider:

A

Projecting just those few attributes in a global secondary index. The Cost is minimal, and the benefit is that it has the lowest possible latency access for non-key items.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

If you need to frequently access some non-key attributes, consider:

A

Projecting those attributes in a global secondary index. The Cost is moderate, but it aims to offset the costs of table scans, and the benefit is that it has the lowest possible latency access for non-key items.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

If you need to frequently access most non-key attributes, consider:

A

Projecting those attributes or even the entire table in a global secondary index. The Cost is up to double of the original latency, but it provides the benefit of Maximum flexibility.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

If you need to rarely query but write or update frequently, consider:

A

Projecting keys only for the global secondary index. The Cost is minimal, and the benefit is that writes or updates are very fast for non-partition key items.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly