2. TRANSACTIONS: WHAT FOR?
⢠Allow
many operations to be canceled at once.
⢠Maintain
⢠Handle
consistency of data.
concurrent requests in a deterministic way.
⢠Guarantee
the persistence of data.
3. TRANSACTIONS: WHAT FOR?
⢠RDBMS
⢠Any
Content Management System
⢠Versioning
⢠Filesystems
Systems (Git, SVN)
(NTFS, HFS, ext3, ext4, BTRfs)
6. TRANSACTIONS: WHAT FOR?
â˘Atomicity: every SQL command is transactional.
â˘Consistency: not only relational but also logical.
â˘Isolation: not necessarily serialized.
â˘Durability: resist to system failures.
http://en.wikipedia.org/wiki/ACID
7. ATOMICITY
⢠The
⢠All
transaction is one or nothing.
its modiďŹcations are applied, or none.
⢠Transactionless
means: each statement has its own
transaction (= autocommit).
8. CONSISTENCY
⢠Transactions
leave the database in a consistent state: all its
internal rules are always enforced.
⢠The
DBMS handles relational consistency, the developer
handles logical consistency.
15. ISOLATION LEVELS AND
READ PHENOMENA
Isolation level
Read
Uncommitted
Read
Committed
Repeatable
Read
Serializable
Dirty reads
may occur
Non-repeatable
Phantom reads
reads
may occur
may occur
may occur
may occur
may occur
16. DBMS AND
ISOLATION LEVELS
Isolation level
Oracle
Firebird
Apache Derby
MS SQL
MySQL
Read
Uncommitted
NO
NO
OK
OK
OK
Read
Committed
Default
Default
Default
Default
OK
Repeatable
Read
Not exactly
OK
OK
OK
Default
Serializable
OK
OK
OK
OK
OK
Note: no-one defaults to Serializable!!