0% found this document useful (0 votes)
228 views21 pages

Lecture 2.3 Serializability

The document discusses transaction management and concurrency control in databases. It covers topics like serializability, conflicting instructions, conflict serializability, view serializability, and testing schedules for serializability using precedence graphs. The document provides definitions and examples to explain these concepts.

Uploaded by

komal yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
228 views21 pages

Lecture 2.3 Serializability

The document discusses transaction management and concurrency control in databases. It covers topics like serializability, conflicting instructions, conflict serializability, view serializability, and testing schedules for serializability using precedence graphs. The document provides definitions and examples to explain these concepts.

Uploaded by

komal yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

Department of Computer Science and Engineering (CSE)

Database
Management System

Course Outcome Will be covered in


CO Title Level this lecture
Number

CO1 To perceive the significance and Remember


implementation of a commercial
relational database system (Oracle)
by writing SQL using the system.
CO2 To understand the relational database Understand
theory, and be able to write
relational algebra expressions for
queries
CO3 To identify the basic issues of Analysis and
transaction processing and application
concurrency control and find out its
solutions.
2
Contents of the Syllabus

UNIT-I [10h]
Overview of Databases: Database concepts, DBMS, Data Base System Architecture (Three
Level ANSI-SPARC Architecture), Advantages and Disadvantages of DBMS, Data Independence,
DBA and Responsibilities of DBA, Relational Data Structure, Keys, Relations, Attributes, Schema and
Instances, Referential integrity, Entity integrity.
Data Models: Relational Model, Network Model, Hierarchical Model, ER Model: Design,
issues, Mapping constraints, ER diagram, Comparison of Models.

Relational Algebra & Relational Calculus: Introduction, Syntax, Semantics, Additional


operators, Grouping and Ungrouping, Relational comparisons, Tuple Calculus, Domain Calculus,
Calculus Vs Algebra, Computational capabilities.

UNIT-II [10h]
Functional dependencies and Normalization: Functional dependencies, Decomposition, Full
Functional Dependency (FFD), Transitive Dependency (TD), Join Dependency (JD), Multi-valued
Dependency (MVD), Normal Forms (1NF, 2NF, 3NF, BCNF), De-normalization.
Database Security: Introduction, Threats, Counter Measures.
Control Structures: Introduction to conditional control, Iterative control and sequential control
statements, Cursors, Views.

3
Contents of the Syllabus

UNIT-III [10h]
Package, Procedures and Triggers: Parts of procedures, Parameter modes, Advantages of
procedures, Syntax for creating triggers, Types of triggers, package specification and package body,
developing a package, Bodiless package, Advantages of packages.
Transaction Management and Concurrency Control: Introduction to Transaction Processing,
Properties of Transactions, Serializability and Recoverability, Need for Concurrency Control, Locking
Techniques, Time Stamping Methods, Optimistic Techniques and Granularity of Data items.

Database Recovery of database: Introduction, Need for Recovery, Types of errors, Recovery
Techniques.

4
Department of Computer Science and Engineering (CSE)

(Transaction Management and Concurrency Control)


Transaction Management and Concurrency Control: Introduction to
Transaction Processing, Properties of Transactions, Serializability and
Recoverability, Need for Concurrency Control, Locking Techniques, Time
Stamping Methods, Optimistic Techniques and Granularity of Data items.
Learning Objective
• About database transactions and their
properties
• concurrency control and role it plays in
maintaining the database’s integrity
• locking methods and how they work
• How optimistic methods ,stamping methods
are used for concurrency control
Learning Outcome
• Importance of ACID properties in transactions.
• Discuss the concepts of concurrency
transparency.
• Discuss the role of locks to prevent
interference problems among multiple users.
Serializability
• When several concurrent transactions are trying to access the same data
item, the instructions within these concurrent transactions must be ordered
in some way so as there are no problem in accessing and releasing the
shared data item. There are three aspects of serializability which are
described here:

• If 2 Transactions are only reading data items – They do not conflict 


Order is unimportant
• If 2 Transactions operate (Read/Write) on Separate Data Items
– They do not conflict  Order is unimportant
• If 1 Transaction Writes to a Data Item and Another Reads or Writes to the
Same Data Item  The Order of Execution IS Important
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
Simplified view of transactions
• We ignore operations other than read and
write instructions
• 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.
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.
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
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
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 >.
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, for each data item Q,
1. If in schedule S, transaction Ti reads the initial value of Q, then in
schedule S’ also transaction Ti must read the initial value of Q.
2. If in schedule S transaction Ti executes read(Q), and that value
was
produced by transaction Tj (if any), then in schedule S’ also
transaction Ti must read the value of Q that was produced by the
same write(Q) operation of transaction Tj .
3. The transaction (if any) that performs the final write(Q) operation
in
schedule S must also perform the final write(Q) operation in
schedule S’.
• As can be seen, view equivalence is also based purely on
reads and writes alone.
View Serializability (Cont.)
• A schedule S is view serializable if 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.
Other Notions of Serializability
• The schedule below produces same outcome as the serial
schedule < T1, T5 >, yet is not conflict equivalent or view
equivalent to it.

• Determining such equivalence requires analysis of


operations other than read and write.
Testing for Serializability
• Consider some schedule of a set of transactions T1, T2, ..., Tn
• Precedence graph — a direct graph where the vertices are the
transactions (names).
• We draw an arc from Ti to Tj if the two transaction conflict, and Ti
accessed the data item on which the conflict arose earlier.
• We may label the arc by the item that was accessed.
• Example of a precedence graph

Test for Conflict Serializability
A schedule is conflict serializable if and only if its
precedence graph is acyclic.
• Cycle-detection algorithms exist which take order n2
time, where n is the number of vertices in the graph.
– (Better algorithms take order n + e where e is
the number of edges.)
• If precedence graph is acyclic, the serializability order
can be obtained by a topological sorting of the graph.
– This is a linear order consistent with the partial
order of the graph.
– For example, a serializability order for Schedule
A would be
T5  T1  T3  T2  T4
• Are there others?
Test for View Serializability
• The precedence graph test for conflict
serializability cannot be used directly to test for
view serializability.
– Extension to test for view serializability has cost
exponential in the size of the precedence graph.
• The problem of checking if a schedule is view
serializable falls in the class of NP-complete
problems.
– Thus, existence of an efficient algorithm is extremely
unlikely.
• However practical algorithms that just check some
sufficient conditions for view serializability can
still be used.
Frequently Asked Questions
• Discuss various types of Locks in Transactions.
• Define Timestamps and their applications.
• What is a Transaction? How Concurrent
Tranasctions carried out?
• Differentiate between Isolation and Durability.
• What are Schedules?
• Define Serilizability.
References

• DatabaseSystemConceptsbySudarshan,Korth(McGraw-
HillEducation)

• FundamentalsofDatabaseSystemByElmasari&Navathe-
PearsonEducation

• http://labe.felk.cvut.cz/~stepan/AE3B33OSD/Transactions.pd
f
• http://cis.csuohio.edu/~sschung/IST331/Coronel_PPT_.pdf
• http://www.geeksforgeeks.org/dbms-gq/transactions-and-co
ncurrency-control-gq
• https://en.wikipedia.org/wiki/Concurrency_control

You might also like