Table-of-Contents-Automatic EDM
Table-of-Contents-Automatic EDM
Table-of-Contents-Automatic EDM
allow concurrency
control security
maintain data integrity
provide for backup and recovery
control redundancy
allow data independence
provide non-procedural query language
perform automatic query optimization
What is a relational database?
What is a relation?
a kind of set
a subset of a Cartesian product
an unordered set of ordered tuples
ABSTRACTION
A transaction is a logical unit of work that contains one or more SQL statements. A transaction is an
atomic unit. The effects of all the SQL statements in a transaction can be either all committed (applied to
the database) or all rolled back (undone from the database).
A transaction begins with the first executable SQL statement.
A transaction ends when it is committed or rolled back, either explicitly with a COMMIT or
ROLLBACK statement or implicitly when a DDL statement is issued.
To illustrate the concept of a transaction, consider a banking database. When a bank customer transfers
money from a savings account to a checking account, the transaction can consist of three separate
operation:
1. Decrement the savings account
2. Increment the checking account
3. Record the transaction in the transaction journal
PROPERTIES OF TRANSACTION
Four properties of Transaction: (ACID PROPERTIES)
1. Atomicity= all changes are made (commit), or none (rollback).
2. Consistency = transaction won't violate declared system integrity constraints
3. Isolation= results independent of concurrent transactions.
4. Durability= committed changes survive various classes of hardware failure
TRANSACTION STATE DIAGRAM
1. Active
This is the initial state. The transaction stay in this state while it is executing.
2. Partially Committed
This is the state after the final statement of the transaction is executed.
3. Failed
After the discovery that normal execution can no longer proceed.
4. Aborted
The state after the transaction has been rolled back and the database has been restored to its state prior to
the start of the transaction.
5. Committed
The state after successful completion of the transaction. We cannot abort or rollback a committed
transaction.
TRANSACTION SCHEDULE
When multiple transactions are executing concurrently, then the order of execution of operations from the
various transactions is known as schedule.
Serial Schedule
Transactions are executed one by one without any interleaved operations from other transactions.
Non-Serial Schedule
A schedule where the operations from a set of concurrent transactions are interleaved.
SERIALIZABILITY
What is Serializability?
A given non serial schedule of n transactions is serializable if it is equivalent to some serial schedule.
i.e. this non serial schedule produce the same result as of the serial schedule. Then the given non serial
schedule is said to be serializable.
A schedule that is not serializable is called a non-serializable.
Non-Serial Schedule Classification
Serializable
Not Serializable
Recoverable
Non Recoverable
Conflict Serializable
View Serializable
Concurrency Control
Concurrency control in database management systems permits many users (assumed to be interactive) to
access a database in a multiprogrammed environment while preserving the illusion that each user has sole
access to the system.
Control is needed to coordinate concurrent accesses to a DBMS so that the overall correctness of the
database is maintained.
Example, users A and B both may wish to read and update the same record in the database at about the
same time.
The relative timing of the two transactions may have an impact on the state of the database at the end of
the transactions.
The end result may be an inconsistent database.
Module Summary
References
Module Summary
References
Module Summary
Assessment
References
Module Summary
Assessment
References