SlideShare a Scribd company logo
1 of 19
Database Systems
Design, Implementation, and Management
11e
Transaction Processing and
Concurrency Control
By: Christian Alfred M. Villena, LPT, MIT
Learning Objectives
2
 In this chapter, students will learn:
 About database transactions and their properties
 What concurrency control is and what role it plays in
maintaining the database’s integrity
 What locking methods are and how they work
Learning Objectives
3
 In this chapter, students will learn:
 How stamping methods are used for concurrency
control
 How optimistic methods are used for concurrency
control
 How database recovery management is used to
maintain database integrity
Transaction
4
 Logical unit of work that must be entirely completed
or aborted
 Consists of:
 SELECT statement
 Series of related UPDATE statements
 Series of INSERT statements
 Combination of SELECT, UPDATE, and INSERT
statements
Transaction
5
 Consistent database state: All data integrity
constraints are satisfied
 Must begin with the database in a known consistent
state to ensure consistency
 Formed by two or more database requests
 Database requests: Equivalent of a single SQL
statement in an application program or transaction
 Consists of a single SQL statement or a collection of
related SQL statements
Evaluating Transaction Results
6
 Not all transactions update database
 SQL code represents a transaction because it accesses a
database
 Improper or incomplete transactions can have
devastating effect on database integrity
 Users can define enforceable constraints based on
business rules
 Other integrity rules are automatically enforced by the
DBMS
Transaction Properties
Atomicity
• All operations of a transaction must be completed
• If not, the transaction is aborted
Consistency
• Permanence of database’s consistent state
Isolation
• Data used during transaction cannot be used by second transaction
until the first is completed
Durability
• Ensures that once transactions are committed, they cannot be
undone or lost
Serializability
• Ensures that the schedule for the concurrent execution of several
transactions should yield consistent results
7
Transaction Management with SQL
8
 SQL statements that provide transaction support
 COMMIT
 ROLLBACK
 Transaction sequence must continue until:
 COMMIT statement is reached
 ROLLBACK statement is reached
 End of program is reached
 Program is abnormally terminated
Transaction Log
9
 Keeps track of all transactions that update the
database
 DBMS uses the information stored in a log for:
 Recovery requirement triggered by a ROLLBACK
statement
 A program’s abnormal termination
 A system failure
Concurrency Control
10
 Coordination of the simultaneous transactions
execution in a multiuser database system
 Objective - Ensures serializability of transactions in a
multiuser database environment
Problems in Concurrency Control
Lost update
• Occurs in two concurrent transactions when:
• Same data element is updated
• One of the updates is lost
Uncommitted data
• Occurs when:
• Two transactions are executed concurrently
• First transaction is rolled back after the second transaction has
already accessed uncommitted data
Inconsistent retrievals
• Occurs when a transaction accesses data before and after one
or more other transactions finish working with such data
11
The Scheduler
12
 Establishes the order in which the operations are
executed within concurrent transactions
 Interleaves the execution of database operations to
ensure serializability and isolation of transactions
 Based on concurrent control algorithms to determine
the appropriate order
 Creates serialization schedule
 Serializable schedule: Interleaved execution of
transactions yields the same results as the serial
execution of the transactions
Concurrency Control with Locking
Methods
13
 Locking methods - Facilitate isolation of data items
used in concurrently executing transactions
 Lock: Guarantees exclusive use of a data item to a
current transaction
 Pessimistic locking: Use of locks based on the
assumption that conflict between transactions is
likely
 Lock manager: Responsible for assigning and
policing the locks used by the transactions
Lock Granularity
14
 Indicates the level of lock use
 Levels of locking
 Database-level lock
 Table-level lock
 Page-level lock
 Page or diskpage: Directly addressable section of a disk
 Row-level lock
 Field-level lock
Figure 10.3 - Database-Level Locking
Sequence
15
Figure 10.4 - An Example of a Table-
Level Lock
16
Figure 10.5 - An Example of a Page-
Level Lock
17
Figure 10.6 - An Example of a Row-
Level Lock
18
TO BE CONTINUED

More Related Content

Similar to 1. Transaction Processing and Concurrency Control.pptx

Transaction conccurency
Transaction conccurencyTransaction conccurency
Transaction conccurencyEsraa Farrag
 
Advanced Database Management Syatem
Advanced Database Management SyatemAdvanced Database Management Syatem
Advanced Database Management Syatemchirag patil
 
1 ) a transaction is a logical unit of work each transaction is sequ.pdf
1 ) a transaction is a logical unit of work each transaction is sequ.pdf1 ) a transaction is a logical unit of work each transaction is sequ.pdf
1 ) a transaction is a logical unit of work each transaction is sequ.pdfkareemangels
 
Advance database system (part 2)
Advance database system (part 2)Advance database system (part 2)
Advance database system (part 2)Abdullah Khosa
 
Dbms sixth chapter_part-1_2011
Dbms sixth chapter_part-1_2011Dbms sixth chapter_part-1_2011
Dbms sixth chapter_part-1_2011sumit_study
 
Transaction concurrency control
Transaction concurrency controlTransaction concurrency control
Transaction concurrency controlAnand Grewal
 
Fazal rafi.. database concurancy control and recovery
Fazal rafi.. database concurancy control and recoveryFazal rafi.. database concurancy control and recovery
Fazal rafi.. database concurancy control and recoverySofthat IT Solutions
 
Transaction Management
Transaction ManagementTransaction Management
Transaction ManagementA. S. M. Shafi
 
concurrency control.ppt
concurrency control.pptconcurrency control.ppt
concurrency control.pptBikalAdhikari4
 
Acid Properties In Database Management System
Acid Properties In Database Management SystemAcid Properties In Database Management System
Acid Properties In Database Management SystemAshish Kumar
 

Similar to 1. Transaction Processing and Concurrency Control.pptx (20)

chp13.pdf
chp13.pdfchp13.pdf
chp13.pdf
 
CH09.ppt
CH09.pptCH09.ppt
CH09.ppt
 
Transaction conccurency
Transaction conccurencyTransaction conccurency
Transaction conccurency
 
Advanced Database Management Syatem
Advanced Database Management SyatemAdvanced Database Management Syatem
Advanced Database Management Syatem
 
Sql server concurrency
Sql server concurrencySql server concurrency
Sql server concurrency
 
Vani dbms
Vani dbmsVani dbms
Vani dbms
 
1 ) a transaction is a logical unit of work each transaction is sequ.pdf
1 ) a transaction is a logical unit of work each transaction is sequ.pdf1 ) a transaction is a logical unit of work each transaction is sequ.pdf
1 ) a transaction is a logical unit of work each transaction is sequ.pdf
 
Advance database system (part 2)
Advance database system (part 2)Advance database system (part 2)
Advance database system (part 2)
 
Dbms sixth chapter_part-1_2011
Dbms sixth chapter_part-1_2011Dbms sixth chapter_part-1_2011
Dbms sixth chapter_part-1_2011
 
Transaction concurrency control
Transaction concurrency controlTransaction concurrency control
Transaction concurrency control
 
nnnn.pptx
nnnn.pptxnnnn.pptx
nnnn.pptx
 
DBMS.pptx
DBMS.pptxDBMS.pptx
DBMS.pptx
 
DBMS UNIT 4
DBMS UNIT 4DBMS UNIT 4
DBMS UNIT 4
 
Tps
TpsTps
Tps
 
Fazal rafi.. database concurancy control and recovery
Fazal rafi.. database concurancy control and recoveryFazal rafi.. database concurancy control and recovery
Fazal rafi.. database concurancy control and recovery
 
Ch 13 D B Admin
Ch 13  D B  AdminCh 13  D B  Admin
Ch 13 D B Admin
 
Concurrent control
Concurrent controlConcurrent control
Concurrent control
 
Transaction Management
Transaction ManagementTransaction Management
Transaction Management
 
concurrency control.ppt
concurrency control.pptconcurrency control.ppt
concurrency control.ppt
 
Acid Properties In Database Management System
Acid Properties In Database Management SystemAcid Properties In Database Management System
Acid Properties In Database Management System
 

More from calf_ville86

Lesson 3 - Network Security.pptx
Lesson 3 - Network Security.pptxLesson 3 - Network Security.pptx
Lesson 3 - Network Security.pptxcalf_ville86
 
Logistics and Managing Transportion.pptx
Logistics and Managing Transportion.pptxLogistics and Managing Transportion.pptx
Logistics and Managing Transportion.pptxcalf_ville86
 
Lesson 3 - Enterprise System Architecture.pptx
Lesson 3 - Enterprise System Architecture.pptxLesson 3 - Enterprise System Architecture.pptx
Lesson 3 - Enterprise System Architecture.pptxcalf_ville86
 
Lesson 3 - The Kimbal Lifecycle.pptx
Lesson 3 - The Kimbal Lifecycle.pptxLesson 3 - The Kimbal Lifecycle.pptx
Lesson 3 - The Kimbal Lifecycle.pptxcalf_ville86
 
Lesson 3 - Basic Application Software.pptx
Lesson 3 - Basic Application Software.pptxLesson 3 - Basic Application Software.pptx
Lesson 3 - Basic Application Software.pptxcalf_ville86
 
Lesson 2 - The Internet, the Web, and Electronic Commerce.pptx
Lesson 2 - The Internet, the Web, and Electronic Commerce.pptxLesson 2 - The Internet, the Web, and Electronic Commerce.pptx
Lesson 2 - The Internet, the Web, and Electronic Commerce.pptxcalf_ville86
 
LESSON 1 - DATABASE MANAGEMENT SYSTEM.pptx
LESSON 1 - DATABASE MANAGEMENT SYSTEM.pptxLESSON 1 - DATABASE MANAGEMENT SYSTEM.pptx
LESSON 1 - DATABASE MANAGEMENT SYSTEM.pptxcalf_ville86
 
Lesson 1 - Introduction to Enterprise Systems for Management.pdf
Lesson 1 - Introduction to Enterprise Systems for Management.pdfLesson 1 - Introduction to Enterprise Systems for Management.pdf
Lesson 1 - Introduction to Enterprise Systems for Management.pdfcalf_ville86
 
Lessoon 1 - Information Technology, The Internet and You.pptx
Lessoon 1 - Information Technology, The Internet and You.pptxLessoon 1 - Information Technology, The Internet and You.pptx
Lessoon 1 - Information Technology, The Internet and You.pptxcalf_ville86
 
DATA WAREHOUSING.pptx
DATA WAREHOUSING.pptxDATA WAREHOUSING.pptx
DATA WAREHOUSING.pptxcalf_ville86
 
Definition of requirements for each project phases.pdf
Definition of requirements for each project phases.pdfDefinition of requirements for each project phases.pdf
Definition of requirements for each project phases.pdfcalf_ville86
 
3. System development life cycle.ppt
3. System development life cycle.ppt3. System development life cycle.ppt
3. System development life cycle.pptcalf_ville86
 
1. Components of Information Systems.pdf
1. Components of Information Systems.pdf1. Components of Information Systems.pdf
1. Components of Information Systems.pdfcalf_ville86
 
Introduction to Information Management.pptx
Introduction to Information Management.pptxIntroduction to Information Management.pptx
Introduction to Information Management.pptxcalf_ville86
 
sybca-bigdata-ppt.pptx
sybca-bigdata-ppt.pptxsybca-bigdata-ppt.pptx
sybca-bigdata-ppt.pptxcalf_ville86
 
1. Business logic.pptx
1. Business logic.pptx1. Business logic.pptx
1. Business logic.pptxcalf_ville86
 

More from calf_ville86 (19)

Lesson 3 - Network Security.pptx
Lesson 3 - Network Security.pptxLesson 3 - Network Security.pptx
Lesson 3 - Network Security.pptx
 
Logistics and Managing Transportion.pptx
Logistics and Managing Transportion.pptxLogistics and Managing Transportion.pptx
Logistics and Managing Transportion.pptx
 
Lesson 3 - Enterprise System Architecture.pptx
Lesson 3 - Enterprise System Architecture.pptxLesson 3 - Enterprise System Architecture.pptx
Lesson 3 - Enterprise System Architecture.pptx
 
Lesson 3 - The Kimbal Lifecycle.pptx
Lesson 3 - The Kimbal Lifecycle.pptxLesson 3 - The Kimbal Lifecycle.pptx
Lesson 3 - The Kimbal Lifecycle.pptx
 
Lesson 3 - Basic Application Software.pptx
Lesson 3 - Basic Application Software.pptxLesson 3 - Basic Application Software.pptx
Lesson 3 - Basic Application Software.pptx
 
Lesson 2 - The Internet, the Web, and Electronic Commerce.pptx
Lesson 2 - The Internet, the Web, and Electronic Commerce.pptxLesson 2 - The Internet, the Web, and Electronic Commerce.pptx
Lesson 2 - The Internet, the Web, and Electronic Commerce.pptx
 
LESSON 1 - DATABASE MANAGEMENT SYSTEM.pptx
LESSON 1 - DATABASE MANAGEMENT SYSTEM.pptxLESSON 1 - DATABASE MANAGEMENT SYSTEM.pptx
LESSON 1 - DATABASE MANAGEMENT SYSTEM.pptx
 
Lesson 1 - Introduction to Enterprise Systems for Management.pdf
Lesson 1 - Introduction to Enterprise Systems for Management.pdfLesson 1 - Introduction to Enterprise Systems for Management.pdf
Lesson 1 - Introduction to Enterprise Systems for Management.pdf
 
Lessoon 1 - Information Technology, The Internet and You.pptx
Lessoon 1 - Information Technology, The Internet and You.pptxLessoon 1 - Information Technology, The Internet and You.pptx
Lessoon 1 - Information Technology, The Internet and You.pptx
 
DATA WAREHOUSING.pptx
DATA WAREHOUSING.pptxDATA WAREHOUSING.pptx
DATA WAREHOUSING.pptx
 
Definition of requirements for each project phases.pdf
Definition of requirements for each project phases.pdfDefinition of requirements for each project phases.pdf
Definition of requirements for each project phases.pdf
 
3. System development life cycle.ppt
3. System development life cycle.ppt3. System development life cycle.ppt
3. System development life cycle.ppt
 
1. Components of Information Systems.pdf
1. Components of Information Systems.pdf1. Components of Information Systems.pdf
1. Components of Information Systems.pdf
 
Introduction to Information Management.pptx
Introduction to Information Management.pptxIntroduction to Information Management.pptx
Introduction to Information Management.pptx
 
sybca-bigdata-ppt.pptx
sybca-bigdata-ppt.pptxsybca-bigdata-ppt.pptx
sybca-bigdata-ppt.pptx
 
PART 1.docx
PART 1.docxPART 1.docx
PART 1.docx
 
Lesson 2.docx
Lesson 2.docxLesson 2.docx
Lesson 2.docx
 
1. Business logic.pptx
1. Business logic.pptx1. Business logic.pptx
1. Business logic.pptx
 
LESSON 1.pdf
LESSON 1.pdfLESSON 1.pdf
LESSON 1.pdf
 

Recently uploaded

Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 

Recently uploaded (20)

Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 

1. Transaction Processing and Concurrency Control.pptx

  • 1. Database Systems Design, Implementation, and Management 11e Transaction Processing and Concurrency Control By: Christian Alfred M. Villena, LPT, MIT
  • 2. Learning Objectives 2  In this chapter, students will learn:  About database transactions and their properties  What concurrency control is and what role it plays in maintaining the database’s integrity  What locking methods are and how they work
  • 3. Learning Objectives 3  In this chapter, students will learn:  How stamping methods are used for concurrency control  How optimistic methods are used for concurrency control  How database recovery management is used to maintain database integrity
  • 4. Transaction 4  Logical unit of work that must be entirely completed or aborted  Consists of:  SELECT statement  Series of related UPDATE statements  Series of INSERT statements  Combination of SELECT, UPDATE, and INSERT statements
  • 5. Transaction 5  Consistent database state: All data integrity constraints are satisfied  Must begin with the database in a known consistent state to ensure consistency  Formed by two or more database requests  Database requests: Equivalent of a single SQL statement in an application program or transaction  Consists of a single SQL statement or a collection of related SQL statements
  • 6. Evaluating Transaction Results 6  Not all transactions update database  SQL code represents a transaction because it accesses a database  Improper or incomplete transactions can have devastating effect on database integrity  Users can define enforceable constraints based on business rules  Other integrity rules are automatically enforced by the DBMS
  • 7. Transaction Properties Atomicity • All operations of a transaction must be completed • If not, the transaction is aborted Consistency • Permanence of database’s consistent state Isolation • Data used during transaction cannot be used by second transaction until the first is completed Durability • Ensures that once transactions are committed, they cannot be undone or lost Serializability • Ensures that the schedule for the concurrent execution of several transactions should yield consistent results 7
  • 8. Transaction Management with SQL 8  SQL statements that provide transaction support  COMMIT  ROLLBACK  Transaction sequence must continue until:  COMMIT statement is reached  ROLLBACK statement is reached  End of program is reached  Program is abnormally terminated
  • 9. Transaction Log 9  Keeps track of all transactions that update the database  DBMS uses the information stored in a log for:  Recovery requirement triggered by a ROLLBACK statement  A program’s abnormal termination  A system failure
  • 10. Concurrency Control 10  Coordination of the simultaneous transactions execution in a multiuser database system  Objective - Ensures serializability of transactions in a multiuser database environment
  • 11. Problems in Concurrency Control Lost update • Occurs in two concurrent transactions when: • Same data element is updated • One of the updates is lost Uncommitted data • Occurs when: • Two transactions are executed concurrently • First transaction is rolled back after the second transaction has already accessed uncommitted data Inconsistent retrievals • Occurs when a transaction accesses data before and after one or more other transactions finish working with such data 11
  • 12. The Scheduler 12  Establishes the order in which the operations are executed within concurrent transactions  Interleaves the execution of database operations to ensure serializability and isolation of transactions  Based on concurrent control algorithms to determine the appropriate order  Creates serialization schedule  Serializable schedule: Interleaved execution of transactions yields the same results as the serial execution of the transactions
  • 13. Concurrency Control with Locking Methods 13  Locking methods - Facilitate isolation of data items used in concurrently executing transactions  Lock: Guarantees exclusive use of a data item to a current transaction  Pessimistic locking: Use of locks based on the assumption that conflict between transactions is likely  Lock manager: Responsible for assigning and policing the locks used by the transactions
  • 14. Lock Granularity 14  Indicates the level of lock use  Levels of locking  Database-level lock  Table-level lock  Page-level lock  Page or diskpage: Directly addressable section of a disk  Row-level lock  Field-level lock
  • 15. Figure 10.3 - Database-Level Locking Sequence 15
  • 16. Figure 10.4 - An Example of a Table- Level Lock 16
  • 17. Figure 10.5 - An Example of a Page- Level Lock 17
  • 18. Figure 10.6 - An Example of a Row- Level Lock 18