Definition
- A collection of operations that
should be treated as a single logical operation.
- ACID properties:
- A: Atomicity: either the entire set
of operations happens or none of it does.
- C: Consistency: the set of
operations taken together should move the system from one consistent state to
another.
- I: Isolation: even though multiple
transactions may operate concurrently, there is a total order on all
transactions. Stated another way: each transaction perceives the system as if
no other transactions were running concurrently.
- D: Durability: even the face of a
crash, once the system has said that a transaction completed, the results of
the transaction must be permanent.
- Why are transactions useful?
- Real world operations correspond to
multiple database operations.
- Examples
Transfer $50 from your account to my
account.
Record the attendance for this class'
students.
Add this employee to the payroll
system.
Create a secondary index on this
attribute.
Maintain secondary indices.
- Why are transactions hard?
- They aren't.
- Main memory caching is essential for
performance, BUT
- Systems fail at the most amazingly
inconvenient times.
- You'd like to be able to make
real-world actions atomic with the transactions (e.g., delivery of the money
out of an ATM machine).
- Testing failure conditions is
challenging.