Normalization, Transactions Flashcards

1
Q

Unnormalized form

A

probably no relationships, just one large table (pro: no joins, easy to restructure, good for NoSQL; con: data duplication, empty attributes, non-atomic attributes)

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

First normal form

A

each attribute must contain atomic values

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

Second normal form

A

must be in 1NF and all non-key columns must describe the primary key

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

Third normal form

A

must be in 2NF, cannot have attributes that provide facts about non-key attributes (“about the key, the whole key, and nothing but the key”)

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

Transaction

A

sequence of statements/queries executed as a single unit (all-or-nothing)

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

ACID properties

A

guarantee transactions maintain the integrity of the database, Atomicity, Consistency, Isolation, Durability

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

Atomicity

A

require that each transaction be all-or-nothing, they are never “in progress”

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

Consistency

A

a transaction must change the database from one valid state to another valid state, must maintain constraints

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

Isolation

A

defines WHEN changes to the database are visible to others

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

Durability

A

guarantees that successful transactions are committed to the database

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

Isolation levels

A

Serializable, repeatable reads, read committed, read uncommitted

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

Lock

A

mechanism for securing data for a transaction

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

2PL

A

two-phase locking protocol, use a read lock and a write lock

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

Expanding phase

A

first part of 2PL, locks are acquired before the transaction begins

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

Shrinking phase

A

last part of 2PL, locks are released after the transaction commits/rolls back

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

Serializable

A

strictest level of isolation, can only execute one transaction on a given unit of data at a time

17
Q

Dirty read

A

when a transaction retrieves a row that has been updated by another transaction that is not yet committed

18
Q

Non-repeatable read

A

when a transaction retrieves a row twice and that row is updated by another transaction that is committed in between

19
Q

Phantom read

A

when a transaction retrieves a set of rows twice and new rows are inserted into or removed from that set by another transaction that is committed in between

20
Q

Repeatable reads

A

2nd strictest, does not maintain range locks and results in phantom reads

21
Q

Read committed

A

3rd strictest, does not maintain range locks and releases read locks immediately after use (data can change after it is read). Results in non-repeatable reads

22
Q

Read uncommitted

A

least strict, allows users to read data that is not yet committed (dirty reads)