13 Transaction Processing Flashcards

(33 cards)

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

What can a data item refer to?

A

A field (e.g., name/ID), a record (row), or a block (chunk of data on disk).

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

What are the steps of a read(X) operation?

A
  • Find the disk block with X
  • Copy the block into RAM
  • Copy X from RAM to a program variable
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the steps of a write(X) operation?

A
  • Find the disk block with X
  • Load block into RAM
  • Update X in RAM
  • Write the updated block back to disk
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a transaction?

A

A group of operations executed together to read and/or update the database.

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

What is the Atomicity property in ACID?

A

All steps of a transaction must happen or none at all.

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

What is the Durability property in ACID?

A

Once a transaction is complete, its changes must be permanent.

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

What is the Consistency property in ACID?

A

A transaction must take the DB from one valid state to another.

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

What is the Isolation property in ACID?

A

A transaction’s changes should not be visible to others until it is done.

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

What are the 5 states of a transaction?

A
  • Active
  • Partially Committed
  • Committed
  • Failed
  • Aborted
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does the recovery manager track?

A

Start, termination, commit, abort, and logs for undo/redo.

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

What does the UNDO operation do?

A

Reverses changes of a failed transaction before commit.

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

What does the REDO operation do?

A

Reapplies changes of a committed transaction after a crash.

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

What is the shadow-database scheme used for?

A

To ensure atomicity and durability by applying changes to a copy first.

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

What are the 4 steps of the shadow-database scheme?

A
  • Apply updates to shadow copy
  • Flush shadow copy to disk
  • Update pointer to shadow copy
  • Delete old DB (commit)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Does the shadow-database scheme support concurrency?

A

No, only one transaction at a time.

17
Q

Why are concurrent transactions useful?

A

Better resource use and faster response time.

18
Q

What is a schedule in transactions?

A

The order in which operations from multiple transactions are run.

19
Q

What is a serial schedule?

A

Transactions run one after another, without interleaving.

20
Q

What is a serializable schedule?

A

A schedule that has the same result as some serial schedule.

21
Q

What is conflict serializability?

A

If we can swap non-conflicting operations to make the schedule serial.

22
Q

When do two operations conflict?

A

They access the same item and at least one is a write.

23
Q

What is view serializability?

A

Same reads/writes and final write as some serial schedule.

24
Q

How do we check conflict serializability?

A

Build a precedence graph. If it has no cycles, it’s conflict serializable.

25
What is a precedence graph?
A graph with transactions as nodes and edges for conflicting ops.
26
What is topological sorting used for in transactions?
To find a serial order from an acyclic precedence graph.
27
What is concurrency control?
Mechanisms to ensure safe execution of concurrent transactions.
28
What are the goals of concurrency control?
* Make schedules serializable * Recoverable * Cascadeless
29
What does cascadeless mean?
Rollback of one transaction doesn’t force others to roll back.
30
In SQL, how is a transaction started and ended?
Starts implicitly; ends with `COMMIT WORK` or `ROLLBACK WORK`.
31
What is SQL auto commit?
Each SQL statement is automatically committed if successful.
32
SQL Consistency Levels (from strictest to weakest)?
* Serializable * Repeatable Read * Read Committed * Read Uncommitted
33
What is snapshot isolation (used in PostgreSQL/Oracle)?
Similar to Repeatable Read; uses a snapshot of data for reads.