SlideShare a Scribd company logo
1 of 26
Download to read offline
Transaction in DBMS
Dr.M.Pyingkodi
Dept of MCA
Kongu Engineering College
Erode,Tamilnadu,India
pyingkodikongu@gmail.com
ACID Properties
ā€¢ Atomicity. Either all operations of the transaction are properly
reflected in the database or none are.
ā€¢ Consistency. Execution of a transaction in isolation preserves the
consistency of the database.
ā€¢ Isolation. Although multiple transactions may execute concurrently,
each transaction must be unaware of other concurrently executing
transactions. Intermediate transaction results must be hidden from
other concurrently executed transactions.
ā€“ That is, for every pair of transactions Ti and Tj, it appears to Ti that either
Tj, finished execution before Ti started, or Tj started execution after Ti
finished.
ā€¢ Durability. After a transaction completes successfully, the changes it
has made to the database persist, even if there are system failures.
A transaction is a unit of program execution that accesses and possibly
updates various data items.To preserve the integrity of data the database
system must ensure:
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
Example of Fund Transfer
ā€¢ Transaction to transfer $50 from account A to
account B:
1. read(A)
2. A := A ā€“ 50
3. write(A)
4. read(B)
5. B := B + 50
6. write(B)
ā€¢ Atomicity requirement ā€” if the transaction fails
after step 3 and before step 6, the system should
ensure that its updates are not reflected in the
database, else an inconsistency will result.
ā€¢ Consistency requirement ā€“ the sum of A and B is
unchanged by the execution of the transaction.
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
Example of Fund Transfer
ā€¢ Isolation requirement ā€” if between steps 3 and 6,
another transaction is allowed to access the partially
updated database, it will see an inconsistent database
(the sum A + B will be less than it should be).
ā€“ Isolation can be ensured trivially by running transactions
serially, that is one after the other.
ā€“ However, executing multiple transactions concurrently has
significant benefits, as we will see later.
ā€¢ Durability requirement ā€” once the user has been
notified that the transaction has completed (i.e., the
transfer of the $50 has taken place), the updates to
the database by the transaction must persist despite
failures.
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
Transaction State
ā€¢ Active ā€“ the initial state; the transaction
stays in this state while it is executing
ā€¢ Partially committed ā€“ after the final
statement has been executed.
ā€¢ Failed -- after the discovery that normal
execution can no longer proceed.
ā€¢ Aborted ā€“ after the transaction has been
rolled back and the database restored to its
state prior to the start of the transaction.
Two options after it has been aborted:
ā€“ restart the transaction; can be done only if no internal logical error
ā€“ kill the transaction
ā€¢ Committed ā€“ after successful completion.
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
Transaction State (Cont.)
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
Implementation of Atomicity and
Durability
ā€¢ The recovery-management component of a
database system implements the support for
atomicity and durability.
ā€¢ The shadow-database scheme:
ā€“ assume that only one transaction is active at a time.
ā€“ a pointer called db_pointer always points to the
current consistent copy of the database.
ā€“ all updates are made on a shadow copy of the
database, and db_pointer is made to point to the
updated shadow copy only after the transaction
reaches partial commit and all updated pages have
been flushed to disk.
ā€“ in case transaction fails, old consistent copy pointed to
by db_pointer can be used, and the shadow copy can
be deleted.
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
Implementation of Atomicity and Durability (Cont.)
ā€¢ Assumes disks do not fail
ā€¢ Useful for text editors, but
ā€“ extremely inefficient for large databases (why?)
ā€“ Does not handle concurrent transactions
ā€¢ Will study better schemes in Chapter 17.
The shadow-database scheme:
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
Concurrent Executions
ā€¢ Multiple transactions are allowed to run
concurrently in the system. Advantages are:
ā€“ increased processor and disk utilization, leading to
better transaction throughput: one transaction can
be using the CPU while another is reading from or
writing to the disk
ā€“ reduced average response time for transactions:
short transactions need not wait behind long ones.
ā€¢ Concurrency control schemes ā€“ mechanisms to
achieve isolation; that is, to control the
interaction among the concurrent transactions in
order to prevent them from destroying the
consistency of the database
ā€“ Will study in Chapter 16, after studying notion of
correctness of concurrent executions.
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
Schedules
ā€¢ Schedule ā€“ a sequences of instructions that specify
the chronological order in which instructions of
concurrent transactions are executed
ā€“ a schedule for a set of transactions must consist of all
instructions of those transactions
ā€“ must preserve the order in which the instructions
appear in each individual transaction.
ā€¢ A transaction that successfully completes its
execution will have a commit instructions as the last
statement (will be omitted if it is obvious)
ā€¢ A transaction that fails to successfully complete its
execution will have an abort instructions as the last
statement (will be omitted if it is obvious)
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
Schedule 1
ā€¢ Let T1 transfer $50 from A to B, and T2 transfer 10% of the
balance from A to B.
ā€¢ A serial schedule in which T1 is followed by T2:
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu,
India
Schedule 2
ā€¢ A serial schedule where T2 is followed by T1
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
Schedule 3
ā€¢ Let T1 and T2 be the transactions defined previously. The
following schedule is not a serial schedule, but it is
equivalent to Schedule 1.
In Schedules 1, 2 and 3, the sum A + B is preserved.
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
Schedule 4
ā€¢ The following concurrent schedule does not
preserve the value of (A + B).
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
Serializability
ā€¢ Basic Assumption ā€“ Each transaction preserves
database consistency.
ā€¢ Thus serial execution of a set of transactions
preserves database consistency.
ā€¢ A (possibly concurrent) schedule is serializable if it is
equivalent to a serial schedule. Different forms of
schedule equivalence give rise to the notions of:
1. conflict serializability
2. view serializability
ā€¢ We ignore operations other than read and write
instructions, and we assume that transactions may
perform arbitrary computations on data in local
buffers in between reads and writes. Our simplified
schedules consist of only read and write instructions.
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
Conflicting Instructions
ā€¢ Instructions li and lj of transactions Ti and Tj
respectively, conflict if and only if there exists
some item Q accessed by both li and lj, and at least
one of these instructions wrote Q.
1. li = read(Q), lj = read(Q). li and lj donā€™t conflict.
2. li = read(Q), lj = write(Q). They conflict.
3. li = write(Q), lj = read(Q). They conflict
4. li = write(Q), lj = write(Q). They conflict
ā€¢ Intuitively, a conflict between li and lj forces a
(logical) temporal order between them.
ā€“ If li and lj are consecutive in a schedule and they do
not conflict, their results would remain the same even
if they had been interchanged in the schedule.
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
Conflict Serializability
ā€¢ If a schedule S can be transformed into a
schedule SĀ“ by a series of swaps of non-
conflicting instructions, we say that S and
SĀ“ are conflict equivalent.
ā€¢ We say that a schedule S is conflict
serializable if it is conflict equivalent to a
serial schedule
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
Conflict Serializability (Cont.)
ā€¢ Schedule 3 can be transformed into Schedule 6, a serial schedule
where T2 follows T1, by series of swaps of non-conflicting
instructions.
ā€“ Therefore Schedule 3 is conflict serializable.
Schedule 3 Schedule 6
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
Conflict Serializability (Cont.)
ā€¢ Example of a schedule that is not conflict
serializable:
ā€¢ We are unable to swap instructions in the above
schedule to obtain either the serial schedule < T3,
T4 >, or the serial schedule < T4, T3 >.
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
View Serializability
ā€¢ Let S and SĀ“ be two schedules with the same set of
transactions. S and SĀ“ are view equivalent if the
following three conditions are met:
1. For each data item Q, if transaction Ti reads the initial
value of Q in schedule S, then transaction Ti must, in
schedule SĀ“, also read the initial value of Q.
2. For each data item Q if transaction Ti executes read(Q)
in schedule S, and that value was produced by
transaction Tj (if any), then transaction Ti must in
schedule SĀ“ also read the value of Q that was produced
by transaction Tj .
3. For each data item Q, the transaction (if any) that
performs the final write(Q) operation in schedule S must
perform the final write(Q) operation in schedule SĀ“.
As can be seen, view equivalence is also based purely
on reads and writes alone.
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
View Serializability (Cont.)
ā€¢ A schedule S is view serializable it is view equivalent to a serial
schedule.
ā€¢ Every conflict serializable schedule is also view serializable.
ā€¢ Below is a schedule which is view-serializable but not conflict
serializable.
ā€¢ What serial schedule is above equivalent to?
ā€¢ Every view serializable schedule that is not conflict serializable
has blind writes.
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
Concurrency Control
ā€¢ A database must provide a mechanism that will
ensure that all possible schedules are
ā€“ either conflict or view serializable, and
ā€“ are recoverable and preferably cascadeless
ā€¢ A policy in which only one transaction can
execute at a time generates serial schedules,
but provides a poor degree of concurrency
ā€“ Are serial schedules recoverable/cascadeless?
ā€¢ Testing a schedule for serializability after it has
executed is a little too late!
ā€¢ Goal ā€“ to develop concurrency control
protocols that will assure serializability.
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
Concurrency Control vs. Serializability Tests
ā€¢ Concurrency-control protocols allow concurrent schedules, but
ensure that the schedules are conflict/view serializable, and are
recoverable and cascadeless.
ā€¢ Concurrency control protocols generally do not examine the
precedence graph as it is being created
ā€“ Instead a protocol imposes a discipline that avoids nonseralizable
schedules.
ā€“ We study such protocols in Chapter 16.
ā€¢ Different concurrency control protocols provide different tradeoffs
between the amount of concurrency they allow and the amount of
overhead that they incur.
ā€¢ Tests for serializability help us understand why a concurrency
control protocol is correct.
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
Weak Levels of Consistency
ā€¢ Some applications are willing to live with weak
levels of consistency, allowing schedules that
are not serializable
ā€“ E.g. a read-only transaction that wants to get an
approximate total balance of all accounts
ā€“ E.g. database statistics computed for query
optimization can be approximate (why?)
ā€“ Such transactions need not be serializable with
respect to other transactions
ā€¢ Tradeoff accuracy for performance
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
Levels of Consistency
ā€¢ Serializable ā€” default
ā€¢ Repeatable read ā€” only committed records to be
read, repeated reads of same record must return
same value. However, a transaction may not be
serializable ā€“ it may find some records inserted by
a transaction but not find others.
ā€¢ Read committed ā€” only committed records can
be read, but successive reads of record may return
different (but committed) values.
ā€¢ Read uncommitted ā€” even uncommitted records
may be read.
ļ® Lower degrees of consistency useful for gathering approximate
information about the database
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India
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.
ā€¢ Levels of consistency specified by SQL-92:
ā€“ Serializable ā€” default
ā€“ Repeatable read
ā€“ Read committed
ā€“ Read uncommitted
Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode,
Tamilnadu, India

More Related Content

What's hot

SQL(DDL & DML)
SQL(DDL & DML)SQL(DDL & DML)
SQL(DDL & DML)Sharad Dubey
Ā 
ACID Property in DBMS
ACID Property in DBMSACID Property in DBMS
ACID Property in DBMSTechtud Network
Ā 
ORACLE PL/SQL
ORACLE PL/SQLORACLE PL/SQL
ORACLE PL/SQLASHABOOPATHY
Ā 
PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts Bharat Kalia
Ā 
Structured Query Language (SQL)
Structured Query Language (SQL)Structured Query Language (SQL)
Structured Query Language (SQL)Syed Hassan Ali
Ā 
Functional dependencies and normalization
Functional dependencies and normalizationFunctional dependencies and normalization
Functional dependencies and normalizationdaxesh chauhan
Ā 
11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMSkoolkampus
Ā 
Database Triggers
Database TriggersDatabase Triggers
Database TriggersAliya Saldanha
Ā 
Multi threading
Multi threadingMulti threading
Multi threadinggndu
Ā 
introduction to NOSQL Database
introduction to NOSQL Databaseintroduction to NOSQL Database
introduction to NOSQL Databasenehabsairam
Ā 
serializability in dbms
serializability in dbmsserializability in dbms
serializability in dbmsSaranya Natarajan
Ā 
Constraints In Sql
Constraints In SqlConstraints In Sql
Constraints In SqlAnurag
Ā 
SQL Queries Information
SQL Queries InformationSQL Queries Information
SQL Queries InformationNishant Munjal
Ā 

What's hot (20)

SQL(DDL & DML)
SQL(DDL & DML)SQL(DDL & DML)
SQL(DDL & DML)
Ā 
ACID Property in DBMS
ACID Property in DBMSACID Property in DBMS
ACID Property in DBMS
Ā 
ORACLE PL/SQL
ORACLE PL/SQLORACLE PL/SQL
ORACLE PL/SQL
Ā 
Dbms acid
Dbms acidDbms acid
Dbms acid
Ā 
PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts
Ā 
Structured Query Language (SQL)
Structured Query Language (SQL)Structured Query Language (SQL)
Structured Query Language (SQL)
Ā 
Functional dependencies and normalization
Functional dependencies and normalizationFunctional dependencies and normalization
Functional dependencies and normalization
Ā 
11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS
Ā 
SQL select clause
SQL select clauseSQL select clause
SQL select clause
Ā 
Database Triggers
Database TriggersDatabase Triggers
Database Triggers
Ā 
Multi threading
Multi threadingMulti threading
Multi threading
Ā 
SQL Commands
SQL Commands SQL Commands
SQL Commands
Ā 
introduction to NOSQL Database
introduction to NOSQL Databaseintroduction to NOSQL Database
introduction to NOSQL Database
Ā 
Dbms 4NF & 5NF
Dbms 4NF & 5NFDbms 4NF & 5NF
Dbms 4NF & 5NF
Ā 
Stored procedure
Stored procedureStored procedure
Stored procedure
Ā 
serializability in dbms
serializability in dbmsserializability in dbms
serializability in dbms
Ā 
Constraints In Sql
Constraints In SqlConstraints In Sql
Constraints In Sql
Ā 
Joins And Its Types
Joins And Its TypesJoins And Its Types
Joins And Its Types
Ā 
Sql commands
Sql commandsSql commands
Sql commands
Ā 
SQL Queries Information
SQL Queries InformationSQL Queries Information
SQL Queries Information
Ā 

Similar to Transaction in DBMS

Management science
Management scienceManagement science
Management sciencekamrul islam
Ā 
Adaptive fault tolerance in cloud survey
Adaptive fault tolerance in cloud surveyAdaptive fault tolerance in cloud survey
Adaptive fault tolerance in cloud surveywww.pixelsolutionbd.com
Ā 
An adaptive algorithm for task scheduling for computational grid
An adaptive algorithm for task scheduling for computational gridAn adaptive algorithm for task scheduling for computational grid
An adaptive algorithm for task scheduling for computational grideSAT Journals
Ā 
Cse viii-advanced-computer-architectures-06cs81-solution
Cse viii-advanced-computer-architectures-06cs81-solutionCse viii-advanced-computer-architectures-06cs81-solution
Cse viii-advanced-computer-architectures-06cs81-solutionShobha Kumar
Ā 
Transactions in dbms
Transactions in dbmsTransactions in dbms
Transactions in dbmsNancy Gulati
Ā 
Presentation on Transaction
Presentation on TransactionPresentation on Transaction
Presentation on TransactionRahul Prajapati
Ā 
Concurrency control
Concurrency controlConcurrency control
Concurrency controlSubhasish Pati
Ā 
Concepts of Data Base Management Systems
Concepts of Data Base Management SystemsConcepts of Data Base Management Systems
Concepts of Data Base Management SystemsDinesh Devireddy
Ā 
Unit 4 dbms
Unit 4 dbmsUnit 4 dbms
Unit 4 dbmsSweta Singh
Ā 
Chapter 2 Time boxing &amp; agile models
Chapter 2   Time boxing &amp; agile modelsChapter 2   Time boxing &amp; agile models
Chapter 2 Time boxing &amp; agile modelsGolda Margret Sheeba J
Ā 
Lecture 5 inter process communication
Lecture 5 inter process communicationLecture 5 inter process communication
Lecture 5 inter process communicationKumbirai Junior Muzavazi
Ā 
Problems in Task Scheduling in Multiprocessor System
Problems in Task Scheduling in Multiprocessor SystemProblems in Task Scheduling in Multiprocessor System
Problems in Task Scheduling in Multiprocessor Systemijtsrd
Ā 
Model-based programming and AI-assisted software development
Model-based programming and AI-assisted software developmentModel-based programming and AI-assisted software development
Model-based programming and AI-assisted software developmentEficode
Ā 
Unit06 dbms
Unit06 dbmsUnit06 dbms
Unit06 dbmsarnold 7490
Ā 
DBMS_Transaction processing ā€“ Schedule ā€“Serializable Schedule ā€“ Concurrency C...
DBMS_Transaction processing ā€“ Schedule ā€“Serializable Schedule ā€“ Concurrency C...DBMS_Transaction processing ā€“ Schedule ā€“Serializable Schedule ā€“ Concurrency C...
DBMS_Transaction processing ā€“ Schedule ā€“Serializable Schedule ā€“ Concurrency C...DrThenmozhiKarunanit
Ā 

Similar to Transaction in DBMS (20)

Transactions
TransactionsTransactions
Transactions
Ā 
Management science
Management scienceManagement science
Management science
Ā 
Adaptive fault tolerance in cloud survey
Adaptive fault tolerance in cloud surveyAdaptive fault tolerance in cloud survey
Adaptive fault tolerance in cloud survey
Ā 
An adaptive algorithm for task scheduling for computational grid
An adaptive algorithm for task scheduling for computational gridAn adaptive algorithm for task scheduling for computational grid
An adaptive algorithm for task scheduling for computational grid
Ā 
Cse viii-advanced-computer-architectures-06cs81-solution
Cse viii-advanced-computer-architectures-06cs81-solutionCse viii-advanced-computer-architectures-06cs81-solution
Cse viii-advanced-computer-architectures-06cs81-solution
Ā 
Transactions in dbms
Transactions in dbmsTransactions in dbms
Transactions in dbms
Ā 
Presentation on Transaction
Presentation on TransactionPresentation on Transaction
Presentation on Transaction
Ā 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
Ā 
Concepts of Data Base Management Systems
Concepts of Data Base Management SystemsConcepts of Data Base Management Systems
Concepts of Data Base Management Systems
Ā 
Unit 4 dbms
Unit 4 dbmsUnit 4 dbms
Unit 4 dbms
Ā 
Chapter 2 Time boxing &amp; agile models
Chapter 2   Time boxing &amp; agile modelsChapter 2   Time boxing &amp; agile models
Chapter 2 Time boxing &amp; agile models
Ā 
24904 lecture11
24904 lecture1124904 lecture11
24904 lecture11
Ā 
Dbms
DbmsDbms
Dbms
Ā 
Lecture 5 inter process communication
Lecture 5 inter process communicationLecture 5 inter process communication
Lecture 5 inter process communication
Ā 
Problems in Task Scheduling in Multiprocessor System
Problems in Task Scheduling in Multiprocessor SystemProblems in Task Scheduling in Multiprocessor System
Problems in Task Scheduling in Multiprocessor System
Ā 
Model-based programming and AI-assisted software development
Model-based programming and AI-assisted software developmentModel-based programming and AI-assisted software development
Model-based programming and AI-assisted software development
Ā 
Unit06 dbms
Unit06 dbmsUnit06 dbms
Unit06 dbms
Ā 
IoT_Testing.ppt
IoT_Testing.pptIoT_Testing.ppt
IoT_Testing.ppt
Ā 
DBMS_Transaction processing ā€“ Schedule ā€“Serializable Schedule ā€“ Concurrency C...
DBMS_Transaction processing ā€“ Schedule ā€“Serializable Schedule ā€“ Concurrency C...DBMS_Transaction processing ā€“ Schedule ā€“Serializable Schedule ā€“ Concurrency C...
DBMS_Transaction processing ā€“ Schedule ā€“Serializable Schedule ā€“ Concurrency C...
Ā 
Cs 331 Data Structures
Cs 331 Data StructuresCs 331 Data Structures
Cs 331 Data Structures
Ā 

More from Pyingkodi Maran

Health Monitoring System using IoT.doc
Health Monitoring System using IoT.docHealth Monitoring System using IoT.doc
Health Monitoring System using IoT.docPyingkodi Maran
Ā 
IoT Industry Adaptation of AI.ppt
IoT Industry Adaptation of AI.pptIoT Industry Adaptation of AI.ppt
IoT Industry Adaptation of AI.pptPyingkodi Maran
Ā 
Creation of Web Portal using DURPAL
Creation of Web Portal using DURPALCreation of Web Portal using DURPAL
Creation of Web Portal using DURPALPyingkodi Maran
Ā 
AWS Relational Database Instance
AWS Relational Database InstanceAWS Relational Database Instance
AWS Relational Database InstancePyingkodi Maran
Ā 
Creation of AWS Instance in Cloud Platform
Creation of AWS Instance in Cloud PlatformCreation of AWS Instance in Cloud Platform
Creation of AWS Instance in Cloud PlatformPyingkodi Maran
Ā 
Amazon Web Service.pdf
Amazon Web Service.pdfAmazon Web Service.pdf
Amazon Web Service.pdfPyingkodi Maran
Ā 
Cloud Computing Introduction
Cloud Computing IntroductionCloud Computing Introduction
Cloud Computing IntroductionPyingkodi Maran
Ā 
Supervised Machine Learning Algorithm
Supervised Machine Learning AlgorithmSupervised Machine Learning Algorithm
Supervised Machine Learning AlgorithmPyingkodi Maran
Ā 
Unsupervised Learning in Machine Learning
Unsupervised Learning in Machine LearningUnsupervised Learning in Machine Learning
Unsupervised Learning in Machine LearningPyingkodi Maran
Ā 
Feature Engineering in Machine Learning
Feature Engineering in Machine LearningFeature Engineering in Machine Learning
Feature Engineering in Machine LearningPyingkodi Maran
Ā 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMSPyingkodi Maran
Ā 
Relational Database and Relational Algebra
Relational Database and Relational AlgebraRelational Database and Relational Algebra
Relational Database and Relational AlgebraPyingkodi Maran
Ā 
IoT_Frameworks_.pdf
IoT_Frameworks_.pdfIoT_Frameworks_.pdf
IoT_Frameworks_.pdfPyingkodi Maran
Ā 
IoT Real world Applications.pdf
IoT Real world Applications.pdfIoT Real world Applications.pdf
IoT Real world Applications.pdfPyingkodi Maran
Ā 
IoT_Introduction.pdf
IoT_Introduction.pdfIoT_Introduction.pdf
IoT_Introduction.pdfPyingkodi Maran
Ā 

More from Pyingkodi Maran (20)

Health Monitoring System using IoT.doc
Health Monitoring System using IoT.docHealth Monitoring System using IoT.doc
Health Monitoring System using IoT.doc
Ā 
IoT Industry Adaptation of AI.ppt
IoT Industry Adaptation of AI.pptIoT Industry Adaptation of AI.ppt
IoT Industry Adaptation of AI.ppt
Ā 
Azure Devops
Azure DevopsAzure Devops
Azure Devops
Ā 
Creation of Web Portal using DURPAL
Creation of Web Portal using DURPALCreation of Web Portal using DURPAL
Creation of Web Portal using DURPAL
Ā 
AWS Relational Database Instance
AWS Relational Database InstanceAWS Relational Database Instance
AWS Relational Database Instance
Ā 
AWS S3 Buckets
AWS S3  BucketsAWS S3  Buckets
AWS S3 Buckets
Ā 
Creation of AWS Instance in Cloud Platform
Creation of AWS Instance in Cloud PlatformCreation of AWS Instance in Cloud Platform
Creation of AWS Instance in Cloud Platform
Ā 
Amazon Web Service.pdf
Amazon Web Service.pdfAmazon Web Service.pdf
Amazon Web Service.pdf
Ā 
Cloud Security
Cloud SecurityCloud Security
Cloud Security
Ā 
Cloud Computing Introduction
Cloud Computing IntroductionCloud Computing Introduction
Cloud Computing Introduction
Ā 
Supervised Machine Learning Algorithm
Supervised Machine Learning AlgorithmSupervised Machine Learning Algorithm
Supervised Machine Learning Algorithm
Ā 
Unsupervised Learning in Machine Learning
Unsupervised Learning in Machine LearningUnsupervised Learning in Machine Learning
Unsupervised Learning in Machine Learning
Ā 
Feature Engineering in Machine Learning
Feature Engineering in Machine LearningFeature Engineering in Machine Learning
Feature Engineering in Machine Learning
Ā 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
Ā 
Relational Database and Relational Algebra
Relational Database and Relational AlgebraRelational Database and Relational Algebra
Relational Database and Relational Algebra
Ā 
IoT_Frameworks_.pdf
IoT_Frameworks_.pdfIoT_Frameworks_.pdf
IoT_Frameworks_.pdf
Ā 
IoT Real world Applications.pdf
IoT Real world Applications.pdfIoT Real world Applications.pdf
IoT Real world Applications.pdf
Ā 
IoT_Introduction.pdf
IoT_Introduction.pdfIoT_Introduction.pdf
IoT_Introduction.pdf
Ā 
Keys in DBMS
Keys in DBMSKeys in DBMS
Keys in DBMS
Ā 
Serializability
SerializabilitySerializability
Serializability
Ā 

Recently uploaded

data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
Ā 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
Ā 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...soginsider
Ā 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
Ā 
Bridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxBridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxnuruddin69
Ā 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
Ā 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
Ā 
BhubaneswaršŸŒ¹Call Girls Bhubaneswar ā¤Komal 9777949614 šŸ’Ÿ Full Trusted CALL GIRL...
BhubaneswaršŸŒ¹Call Girls Bhubaneswar ā¤Komal 9777949614 šŸ’Ÿ Full Trusted CALL GIRL...BhubaneswaršŸŒ¹Call Girls Bhubaneswar ā¤Komal 9777949614 šŸ’Ÿ Full Trusted CALL GIRL...
BhubaneswaršŸŒ¹Call Girls Bhubaneswar ā¤Komal 9777949614 šŸ’Ÿ Full Trusted CALL GIRL...Call Girls Mumbai
Ā 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
Ā 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
Ā 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsvanyagupta248
Ā 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
Ā 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxmaisarahman1
Ā 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxSCMS School of Architecture
Ā 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdfKamal Acharya
Ā 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesRAJNEESHKUMAR341697
Ā 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Servicemeghakumariji156
Ā 
Air Compressor reciprocating single stage
Air Compressor reciprocating single stageAir Compressor reciprocating single stage
Air Compressor reciprocating single stageAbc194748
Ā 

Recently uploaded (20)

data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
Ā 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Ā 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Ā 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
Ā 
Bridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxBridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptx
Ā 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Ā 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
Ā 
BhubaneswaršŸŒ¹Call Girls Bhubaneswar ā¤Komal 9777949614 šŸ’Ÿ Full Trusted CALL GIRL...
BhubaneswaršŸŒ¹Call Girls Bhubaneswar ā¤Komal 9777949614 šŸ’Ÿ Full Trusted CALL GIRL...BhubaneswaršŸŒ¹Call Girls Bhubaneswar ā¤Komal 9777949614 šŸ’Ÿ Full Trusted CALL GIRL...
BhubaneswaršŸŒ¹Call Girls Bhubaneswar ā¤Komal 9777949614 šŸ’Ÿ Full Trusted CALL GIRL...
Ā 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
Ā 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
Ā 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
Ā 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
Ā 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
Ā 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
Ā 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Ā 
Call Girls in South Ex (delhi) call me [šŸ”9953056974šŸ”] escort service 24X7
Call Girls in South Ex (delhi) call me [šŸ”9953056974šŸ”] escort service 24X7Call Girls in South Ex (delhi) call me [šŸ”9953056974šŸ”] escort service 24X7
Call Girls in South Ex (delhi) call me [šŸ”9953056974šŸ”] escort service 24X7
Ā 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
Ā 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planes
Ā 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Ā 
Air Compressor reciprocating single stage
Air Compressor reciprocating single stageAir Compressor reciprocating single stage
Air Compressor reciprocating single stage
Ā 

Transaction in DBMS

  • 1. Transaction in DBMS Dr.M.Pyingkodi Dept of MCA Kongu Engineering College Erode,Tamilnadu,India pyingkodikongu@gmail.com
  • 2. ACID Properties ā€¢ Atomicity. Either all operations of the transaction are properly reflected in the database or none are. ā€¢ Consistency. Execution of a transaction in isolation preserves the consistency of the database. ā€¢ Isolation. Although multiple transactions may execute concurrently, each transaction must be unaware of other concurrently executing transactions. Intermediate transaction results must be hidden from other concurrently executed transactions. ā€“ That is, for every pair of transactions Ti and Tj, it appears to Ti that either Tj, finished execution before Ti started, or Tj started execution after Ti finished. ā€¢ Durability. After a transaction completes successfully, the changes it has made to the database persist, even if there are system failures. A transaction is a unit of program execution that accesses and possibly updates various data items.To preserve the integrity of data the database system must ensure: Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 3. Example of Fund Transfer ā€¢ Transaction to transfer $50 from account A to account B: 1. read(A) 2. A := A ā€“ 50 3. write(A) 4. read(B) 5. B := B + 50 6. write(B) ā€¢ Atomicity requirement ā€” if the transaction fails after step 3 and before step 6, the system should ensure that its updates are not reflected in the database, else an inconsistency will result. ā€¢ Consistency requirement ā€“ the sum of A and B is unchanged by the execution of the transaction. Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 4. Example of Fund Transfer ā€¢ Isolation requirement ā€” if between steps 3 and 6, another transaction is allowed to access the partially updated database, it will see an inconsistent database (the sum A + B will be less than it should be). ā€“ Isolation can be ensured trivially by running transactions serially, that is one after the other. ā€“ However, executing multiple transactions concurrently has significant benefits, as we will see later. ā€¢ Durability requirement ā€” once the user has been notified that the transaction has completed (i.e., the transfer of the $50 has taken place), the updates to the database by the transaction must persist despite failures. Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 5. Transaction State ā€¢ Active ā€“ the initial state; the transaction stays in this state while it is executing ā€¢ Partially committed ā€“ after the final statement has been executed. ā€¢ Failed -- after the discovery that normal execution can no longer proceed. ā€¢ Aborted ā€“ after the transaction has been rolled back and the database restored to its state prior to the start of the transaction. Two options after it has been aborted: ā€“ restart the transaction; can be done only if no internal logical error ā€“ kill the transaction ā€¢ Committed ā€“ after successful completion. Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 6. Transaction State (Cont.) Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 7. Implementation of Atomicity and Durability ā€¢ The recovery-management component of a database system implements the support for atomicity and durability. ā€¢ The shadow-database scheme: ā€“ assume that only one transaction is active at a time. ā€“ a pointer called db_pointer always points to the current consistent copy of the database. ā€“ all updates are made on a shadow copy of the database, and db_pointer is made to point to the updated shadow copy only after the transaction reaches partial commit and all updated pages have been flushed to disk. ā€“ in case transaction fails, old consistent copy pointed to by db_pointer can be used, and the shadow copy can be deleted. Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 8. Implementation of Atomicity and Durability (Cont.) ā€¢ Assumes disks do not fail ā€¢ Useful for text editors, but ā€“ extremely inefficient for large databases (why?) ā€“ Does not handle concurrent transactions ā€¢ Will study better schemes in Chapter 17. The shadow-database scheme: Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 9. Concurrent Executions ā€¢ Multiple transactions are allowed to run concurrently in the system. Advantages are: ā€“ increased processor and disk utilization, leading to better transaction throughput: one transaction can be using the CPU while another is reading from or writing to the disk ā€“ reduced average response time for transactions: short transactions need not wait behind long ones. ā€¢ Concurrency control schemes ā€“ mechanisms to achieve isolation; that is, to control the interaction among the concurrent transactions in order to prevent them from destroying the consistency of the database ā€“ Will study in Chapter 16, after studying notion of correctness of concurrent executions. Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 10. Schedules ā€¢ Schedule ā€“ a sequences of instructions that specify the chronological order in which instructions of concurrent transactions are executed ā€“ a schedule for a set of transactions must consist of all instructions of those transactions ā€“ must preserve the order in which the instructions appear in each individual transaction. ā€¢ A transaction that successfully completes its execution will have a commit instructions as the last statement (will be omitted if it is obvious) ā€¢ A transaction that fails to successfully complete its execution will have an abort instructions as the last statement (will be omitted if it is obvious) Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 11. Schedule 1 ā€¢ Let T1 transfer $50 from A to B, and T2 transfer 10% of the balance from A to B. ā€¢ A serial schedule in which T1 is followed by T2: Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 12. Schedule 2 ā€¢ A serial schedule where T2 is followed by T1 Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 13. Schedule 3 ā€¢ Let T1 and T2 be the transactions defined previously. The following schedule is not a serial schedule, but it is equivalent to Schedule 1. In Schedules 1, 2 and 3, the sum A + B is preserved. Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 14. Schedule 4 ā€¢ The following concurrent schedule does not preserve the value of (A + B). Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 15. Serializability ā€¢ Basic Assumption ā€“ Each transaction preserves database consistency. ā€¢ Thus serial execution of a set of transactions preserves database consistency. ā€¢ A (possibly concurrent) schedule is serializable if it is equivalent to a serial schedule. Different forms of schedule equivalence give rise to the notions of: 1. conflict serializability 2. view serializability ā€¢ We ignore operations other than read and write instructions, and we assume that transactions may perform arbitrary computations on data in local buffers in between reads and writes. Our simplified schedules consist of only read and write instructions. Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 16. Conflicting Instructions ā€¢ Instructions li and lj of transactions Ti and Tj respectively, conflict if and only if there exists some item Q accessed by both li and lj, and at least one of these instructions wrote Q. 1. li = read(Q), lj = read(Q). li and lj donā€™t conflict. 2. li = read(Q), lj = write(Q). They conflict. 3. li = write(Q), lj = read(Q). They conflict 4. li = write(Q), lj = write(Q). They conflict ā€¢ Intuitively, a conflict between li and lj forces a (logical) temporal order between them. ā€“ If li and lj are consecutive in a schedule and they do not conflict, their results would remain the same even if they had been interchanged in the schedule. Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 17. Conflict Serializability ā€¢ If a schedule S can be transformed into a schedule SĀ“ by a series of swaps of non- conflicting instructions, we say that S and SĀ“ are conflict equivalent. ā€¢ We say that a schedule S is conflict serializable if it is conflict equivalent to a serial schedule Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 18. Conflict Serializability (Cont.) ā€¢ Schedule 3 can be transformed into Schedule 6, a serial schedule where T2 follows T1, by series of swaps of non-conflicting instructions. ā€“ Therefore Schedule 3 is conflict serializable. Schedule 3 Schedule 6 Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 19. Conflict Serializability (Cont.) ā€¢ Example of a schedule that is not conflict serializable: ā€¢ We are unable to swap instructions in the above schedule to obtain either the serial schedule < T3, T4 >, or the serial schedule < T4, T3 >. Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 20. View Serializability ā€¢ Let S and SĀ“ be two schedules with the same set of transactions. S and SĀ“ are view equivalent if the following three conditions are met: 1. For each data item Q, if transaction Ti reads the initial value of Q in schedule S, then transaction Ti must, in schedule SĀ“, also read the initial value of Q. 2. For each data item Q if transaction Ti executes read(Q) in schedule S, and that value was produced by transaction Tj (if any), then transaction Ti must in schedule SĀ“ also read the value of Q that was produced by transaction Tj . 3. For each data item Q, the transaction (if any) that performs the final write(Q) operation in schedule S must perform the final write(Q) operation in schedule SĀ“. As can be seen, view equivalence is also based purely on reads and writes alone. Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 21. View Serializability (Cont.) ā€¢ A schedule S is view serializable it is view equivalent to a serial schedule. ā€¢ Every conflict serializable schedule is also view serializable. ā€¢ Below is a schedule which is view-serializable but not conflict serializable. ā€¢ What serial schedule is above equivalent to? ā€¢ Every view serializable schedule that is not conflict serializable has blind writes. Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 22. Concurrency Control ā€¢ A database must provide a mechanism that will ensure that all possible schedules are ā€“ either conflict or view serializable, and ā€“ are recoverable and preferably cascadeless ā€¢ A policy in which only one transaction can execute at a time generates serial schedules, but provides a poor degree of concurrency ā€“ Are serial schedules recoverable/cascadeless? ā€¢ Testing a schedule for serializability after it has executed is a little too late! ā€¢ Goal ā€“ to develop concurrency control protocols that will assure serializability. Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 23. Concurrency Control vs. Serializability Tests ā€¢ Concurrency-control protocols allow concurrent schedules, but ensure that the schedules are conflict/view serializable, and are recoverable and cascadeless. ā€¢ Concurrency control protocols generally do not examine the precedence graph as it is being created ā€“ Instead a protocol imposes a discipline that avoids nonseralizable schedules. ā€“ We study such protocols in Chapter 16. ā€¢ Different concurrency control protocols provide different tradeoffs between the amount of concurrency they allow and the amount of overhead that they incur. ā€¢ Tests for serializability help us understand why a concurrency control protocol is correct. Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 24. Weak Levels of Consistency ā€¢ Some applications are willing to live with weak levels of consistency, allowing schedules that are not serializable ā€“ E.g. a read-only transaction that wants to get an approximate total balance of all accounts ā€“ E.g. database statistics computed for query optimization can be approximate (why?) ā€“ Such transactions need not be serializable with respect to other transactions ā€¢ Tradeoff accuracy for performance Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 25. Levels of Consistency ā€¢ Serializable ā€” default ā€¢ Repeatable read ā€” only committed records to be read, repeated reads of same record must return same value. However, a transaction may not be serializable ā€“ it may find some records inserted by a transaction but not find others. ā€¢ Read committed ā€” only committed records can be read, but successive reads of record may return different (but committed) values. ā€¢ Read uncommitted ā€” even uncommitted records may be read. ļ® Lower degrees of consistency useful for gathering approximate information about the database Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India
  • 26. 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. ā€¢ Levels of consistency specified by SQL-92: ā€“ Serializable ā€” default ā€“ Repeatable read ā€“ Read committed ā€“ Read uncommitted Dr.M.Pyingkodi, Assistant Professor(Sr.Gr), MCA Department, Kongu Engineering College, Erode, Tamilnadu, India