07 Transactions Flashcards
1
Q
types of transaction scheduling
A
- serial
- does not allow interleaving
- highest level of safety
- poor efficiency - equivalent
- allow interleaving
- same output - serializable
- combination of serial and equivalent
2
Q
transaction properties: ACID
A
A: atomicity
- 1 transaction is one unit
- do all or nothing
C: consistency
- each transaction preserves the consistency of db
- before and after transaction
- consistency does not guarantee correctness
I: isolation
- transactions are isolated until completion
D: durability
- once transaction completed, holds true even if system crashes
- record history, go back if cannot complete
- stored on disk
3
Q
transactions keywords
A
- commit
- end transaction and make changes permanently - rollback
- discard all pending changes - save point
- marker that divides transaction to pieces - rollback to save point
- revert to specified save point
4
Q
recovery
A
- transactions unable to protect everything eg.
- system crash
- power failure
- disc crash
- user mistake - good practice to prevent
- robust system (linux)
- security (local network)
create save points
backup transaction logs
backup power supply
5
Q
concurrency control: Lock
A
- force system to become non-concurrent (like mutex)
- lock granularity
- database level
- table level
- row level
- field level - dead lock may occur
6
Q
optimisation methods for locks
A
- no need locks for read operations
- many write operations do not write the same data.
- even if same data, often not at the same time
- go ahead with execution assuming best case scenario.
- if violations happen, restore to original state
- 3 method phase
- read
- validate integrity and consistency
- write