Chapter 4 Hello, Databases Flashcards

1
Q

ACID concepts in transactions

A

Atomic, consistent, Isolated, durable 1. Atomic: all or nothing 2. Consistent: adheres to defined rules and restrictions 3. Isolation: each transaction is independent 4. Durability: all changes in DB are permanent in transaction

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

RDS Maintenance Window

A

Time window at which AWS will apply updates, patches

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

RDS Storage types:

A
  1. General Purpose SSD (cost effective, wide applicability, burstable performance)
  2. Proviosioned IOPS (consistent and intensive I/O)
  3. Magnetic Storage: backward compatibility focused
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Pros and cons of read replication

A

Pro: improves read performance Con: read are not strongly consistent

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

Describe point in time RDS recovery

A

RDS automatically takes a daily backup of the DB. Then it records transaction logs as changes are made to the DB. RDS will recover the DB by applying the recorded logs against the daily snapshot.

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

One way to improve latency when taking a snapshot

A

Enable multi-AZ. The snapshot will be made off a standby node instead of the primary

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

What does RDS use for encryption at rest?

A

AWS KMS (AES 256), encryption must be configured when an RDS instance is created.

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

What does RDS use for encryption in transit?

A

SSL certificates

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

What can you use to authenticate to a DB without using user credentials? What DBs support this feature?

A

IAM DB Authentication, supported in MySQL and Postgres

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

What is a cluster volume?

A

Within Aurora, a virtual database storage volume that spans multiple Availability Zones, and each Availability Zone has a copy of the DB cluster data

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

What is Aurora Serverless?

A

on demand, auto scaling configuration for Aurora

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

What keys are found within a DynamoDB item?

A
  1. Partition Key 2. Sort Key
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do partition and sort keys work?

A

When items have the same partition key, they are collocated in the same partition. The sort key acts to sort these collocated items within the partition. Together, they are known as a composite key. Example partition key: Artist Example sort key: SongTitle

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

What primary keys does DynamoDB support?

A
  1. Primary Key 2. Primary Key and Sort Key (composite key)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Does DynamoDB support secondary keys? What is the benefit?

A

Yes, the benefit is that it creates efficient access with attributes other than the primary key.

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

Local vs Global secondary index in DynamoDB

A

Local: same partition key, different sort key. You can only make one at the time you create the table. Cannot add, remove, modify later. Global: Distinct partition and sort key. You can add, remove, modify later.

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

DynamoDB Burst Capacity

A

Reserved capacity in DB which allows ~5 minutes of peak load, over normal expected load.

18
Q

DynamoDB Adaptive Capacity

A

Allows additional RCUs to be allocated to a hot partition (as long as provisioned table capacity not exceeded). On by default.

19
Q

Are DynamoDB Global tables read consistent?

A

Not by default. If you want strong read consistency, then all reads and writes must occur within the same region, and you must enable read consistency.

20
Q

What is write policy for global DynamoDB tables?

A

last writer wins

21
Q

DynamoDB Local

A

A local, self hosted version of DynamoDB. Good for development testing.

22
Q

What backup and restore features does DynamoDB support?

A

On demand backups: no effect on availability/throughput and no consumption of provisioned throughput

Point in time recovery: Backup to any point in past 35 days

23
Q

DynamoDB encryption

A

Default encryption at rest via KMS with Customer Master Key

24
Q

DynamoDB Best Practice

A

Ensure partition keys is distributed evenly. For example, us a partition key of ID, when there are many users.

25
Q

Difference b/t query and scan?

A

Scan returns all item attributes by scanning every item in table. Queries are more efficient b/c it searches based on primary key values.

26
Q

Give a use case of DynamoDB streams

A

When user signs up, item it added to table triggering lambda function, which uses SES to send welcome email.

27
Q

Options available for DynamoDB Streams

A
  1. triggers
  2. data replication within and across AWS regions
  3. materialized views of datain tables
  4. data analysis using Kinesis materialized views
28
Q

Redshift component hierarchy

A
  1. Client application
  2. leader node
  3. compute node
  4. node slice
  5. data
29
Q

Explain distribution in Redshift and the different types available.

A

Distribution minimizes impact of redistribution by locating data where it is needed before query execution.

  1. EVEN Distribution: row distributed across slices in round-robin fashion. Default setting.
  2. Key Distribution: rows distributed according to values in one column. Leader node attempts to place matching values on same node slice. Use when querying heavily against values of specific column
  3. ALL Distribution: copy of entire table is distributed to every node. A lot more storage needed for this. Also slow to load, update, insert. Use only for slow moving tables that aren’t changed frequently.
30
Q

How can you sort a table in Redshift?

A

sort key

31
Q

Redshift spectrum

A

Allows you to run SQL queries against exabytes of unsructured data in S3

32
Q

Why woudl an in memory, distributed cache be a cost saving measure?

A

A distributed cache would replace having the provision extra DB nodes for intermittent spikes in demand. This is cheaper.

33
Q

____ manages ____ more as a relational database because of its replication and persistence features.

A
  1. ElastiCache
  2. Redis
34
Q

Use Memcached for:

A
  1. Object caching is primary goal (i.e. offload db)
  2. You want simple caching
  3. You plan to run large cache nodes and require multithreaded performance w/ multi core
  4. You want to scale horizontally
35
Q

Use Redis for

A
  1. you need advanced data types like lists and sets
  2. sorting and ranking dataset in memory
  3. pub/sub capabilities
  4. key store data persistence
  5. multi AZ with failover
  6. transactional support
36
Q

DynamoDB Accelerator

A

Fully managed in memory cache for DynamoDB. Only pay for capacity you provision.

37
Q

AWS SCT

A

‘Schema Conversion Tool’. Allows heterogeneous db migrations by converting source db schema and associated DB objects (views, stored procedures, etc.) into format compatible with target database.

Will flag anything that has to be done manually.

38
Q

RCU vs WCU in DynamoDB

A

One read capacity unit (RCU) represents one strongly consistent read per second or two eventually consistent reads per second for an item up to 4 KB in size. (can support twice as many eventual consistent reads)

For writing data, know that one write capacity unit (WCU) represents one write per second for an item up to 1 KB in size

39
Q

How does DynamoDB spread RCUs and WCUs across partitions?

A

evenly

40
Q

Formula for determining RCU consistent reads

A

(readCount x readSize) / 4

*answer may be rounded up

41
Q

Formula for calculating RCU for eventual read

A

((readCount x readSize) / 4) / 2

42
Q

What is a DynamoDB Stream?

A

Featrure that emits events when modification occurs in DynamoDB Table

  1. Events can carry content of row(s) being modified
  2. Event guaranteed to be in same order as modifications
  3. No impact on source table
  4. Common integration with Lambda