Transactions and ACID Flashcards

1
Q

Transactions

A

A sequence of queries.
BEGIN Transaction

COMMIT

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

ACID

A
  • atomicity
  • consistency
  • isolation
  • durability
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Atomicity

A

Guarantees each transaction to be treated as a single unit (everything happens in a transaction or nothing happens).

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

Consistency

A

Ensures that a transaction can only bring the database from one consistent state to another; any data wrote must be valid according to all defined rules. A strong way of defining consistency is to say that it should correctly transform the database state to reflect the effect of a real world event.

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

Isolation

A

Transactions are executed concurrently; if one transaction starts, and then another one starts and finishes which changes the database itself, the original transaction is not effected (will act on the previous version of the database).

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

Durability

A

Guarantees that if a transaction has been committed, it will stay committed even if the system fails.

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

Types of Isolation

A
  • read uncommitted
  • read committed
  • repeatable read
  • serialisable
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Read Uncommitted

A

Fine to read uncommitted data.

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

Read Committed

A

Can only read committed data.

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

Repeatable Read

A

If you read the same thing twice in a transaction, you must get the same return value.

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

Serialisable

A

Transactions can be performed in a serial manner.

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

Transaction may abort because of…

A
  • Due to integrity constraints, or other run-time errors etc. For example, poor concurrency (two people book the same flight at the same time).
  • Deadlocks when using two-phase locking.
  • Explicit request -> rollbacks.
  • Media failures -> the medium holding the database becomes unreadable (change of bits, head crash). Safeguards include RAID or archives/copies.
  • Catastrophic failures -> the medium is destroyed (explosion, fires). Safeguards include archives and copies at safe/different location.
  • System failures -> information about active transition’s state is lost (power failure, software error).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly