Transactions Flashcards

1
Q

A critera for DMBS?

A

• DBMS must allow concurrent access to
databases.
– Imagine a bank where account information is
stored in a database not allowing concurrent
access. Then only one person could do a
withdrawal in an ATM machine at the time –
anywhere!
• Uncontrolled concurrent access may lead
to problems.

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

Explain running in Parallell

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

Explain Interleaving.

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

Explain Serializability.

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

Explain Atomicity.

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

Which are ACID transactions?

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

Explain Transactions in SQL.

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

How do we controll transactions?

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

Explain Read-only vs Read-write

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

Explain SET TRANSACTIONS.

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

Explain drawbacks with serializability and atomicity.

A

Drawbacks
• Serializability and atomicity are necessary,
but don’t come without a cost.
– We must retain old data until the transaction
commits.
– Other transactions may need to wait for one
to complete.
• In some cases some interference may be
acceptable, and could speed up the
system greatly.

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

What is the worst that could happen?

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

Explain Isolation Levels.

A

Isolation levels
• ANSI SQL standard defines four isolation
levels, which are choices about what kinds
of interference are allowed between
transactions.
• Each transaction chooses its own isolation
level, deciding how other transactions may
interfere with it.
• Isolation level is defined in terms of three
phenomena that can occur.

17
Q

Which are intereference types.

A

Kinds of interference
The ANSI SQL standard describes:
• Dirty read
• Non-repeatable read
• Phantom

18
Q

What is Dirty Read?

A

Dirty read
• Transaction T1 modifies a data item.
• Another transaction T2 then reads that
data item before T1 performs a COMMIT
or ROLLBACK.
• If T1 then performs a ROLLBACK, T2 has
read a data item that was never committed
and so never really existed.

19
Q

Explain Non-Repeatable Read.

A

Non-repeatable read
• Transaction T1 reads a data item.
• Another transaction T2 then modifies or
deletes that data item and commits.
• If T1 then attempts to re-read the data
item, it receives a modified value or
discovers that the data item has been
deleted.

20
Q

Explain Phantom.

A
21
Q

Which are the isolation levels?

A

Choosing isolation level
• Within a transaction we can choose the
isolation level:
where X is one of
SET TRANSACTION ISOLATION LEVEL X;
• SERIALIZABLE
• READ COMMITTED
• READ UNCOMMITTED
• REPEATABLE READ

22
Q

What are the differences between isolation levels?

A
23
Q

Explain READ UNCOMMITTED.

A

READ UNCOMMITTED
• If a transaction is run with isolation level
READ UNCOMMITTED, then the transaction
allows other transactions to modify the
database while running.
• Anything that is changed by another
transaction affects the reads of this
transaction, even if the other transaction
has not yet committed!

24
Q

Explain READ COMMITTED.

A

READ COMMITTED
• If a transaction is run with isolation level
READ COMMITTED, then the transaction
allows other transactions to modify the
database while running.
• Anything that is committed by another
transaction affects the reads of this
transaction.

25
Q

Explain REPEATABLE READ.

A

REPEATABLE READ
• If a transaction is run with isolation level
REPEATABLE READ, it works like read
committed, except:
• If the transaction reads more than once,
we are guaranteed to get at least the
same tuples again (though we could get
more).

26
Q

Explain Seriaizable.

A
27
Q
A
28
Q
A
29
Q
A
30
Q
A
31
Q
A
32
Q

Summarize Transactions.

A

Summary transactions
• DBMS must ensure that different
processes don’t interfere with each other!
– ”ACID”: Atomicity, Consistency, Isolation,
Durability.
– The isolation levels of transactions may vary.
• Serializable
• Read Committed
• Read Uncommitted
• Repeatable Read
– Isolation level affects only that transaction!

33
Q
A