Professional Documents
Culture Documents
II2250 Manajemen Basis Data Transactions
II2250 Manajemen Basis Data Transactions
Transactions
Slides are taken from: Database Systems Concepts, 6th edition - Chapter 14
©Silberschatz, Korth, Sudarshan
Objectives
• Students are able to:
• Explain the importance of transaction properties
• Explain serializable transactions
• Explain the concept of implicit commits
• Describe the issues specific to efficient transaction execution
• Explain at least two transaction protocols
Schedule 3 Schedule 6
Database System Concepts 6th edition - Chapter 14
3/13/2020 21
(c) Silberschatz, Korth, Sudarshan
Conflict Serializability (Cont.)
• Example of a schedule that is not conflict serializable:
3/13/2020 36
Dirty Reads
• aka. Uncommitted
dependency: transaction is
allowed to read data from
a row that has been
modified by another
running transaction and
not yet committed.
• Level of consistency read
uncommitted allows dirty
reads
3/13/2020 37
Non-Repeatable Reads
• During the course of a
transaction, a row is
retrieved twice and the
values within the row differ
between reads
• Level of consistency read
committed allows non-
repeatable reads
3/13/2020 38
Phantom Reads
• In the course of a
transaction, new
rows are added by
another
transaction to the
records being read
• Level of
consistency
repeatable-read
allows phantom
reads
3/13/2020 39
Transaction Definition in SQL
• Data manipulation language must include a construct for specifying the set of actions
that comprise a transaction.
• In SQL, a transaction begins implicitly.
• A transaction in SQL ends by:
• Commit work commits current transaction and begins a new one.
• Rollback work causes current transaction to abort.
• In almost all database systems, by default, every SQL statement also commits implicitly if
it executes successfully
• Implicit commit can be turned off by a database directive
• E.g. in JDBC: connection.setAutoCommit(false);
• Isolation level can be set at database level
• Isolation level can be changed at start of transaction, e.g.:
• in SQL: set transaction isolation level serializable
• in JDBC: connection.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE)