SlideShare a Scribd company logo
1 of 42
Transaction
A transaction is a unit of work performed within a database
Transaction is a logical unit that is
independently executed for
data retrieval or updates
Transactions are represented as Schedules
t0
t1
t2
t3
t4
12-04-2019 1by : Jyoti Lakhani
States of a Transaction
12-04-2019 2by : Jyoti Lakhani
SQL Transaction is helpful to execute one more statements as a set.
SQL Transaction
12-04-2019 3by : Jyoti Lakhani
States of a Transaction: COMMIT
12-04-2019 4by : Jyoti Lakhani
States of a Transaction: ROLLBACK
12-04-2019 5by : Jyoti Lakhani
Complete life cycle of a Transaction
12-04-2019 6by : Jyoti Lakhani
Properties of a Transaction
12-04-2019 7by : Jyoti Lakhani
ACID Properties
12-04-2019 8by : Jyoti Lakhani
ACID Properties: ATOMICITY
ATOMICITY
A transaction must be fully complete, saved (committed) or completely
undone (rolled back).
Begin
Commit
RollBack
ALL
NONE12-04-2019 9by : Jyoti Lakhani
ACID Properties: CONSISTANCY
CONSISTENCY
The transaction must be fully compliant with the state of the
database as it was prior to the transaction
CONSISTENCY
INCONSISTENCY
12-04-2019 10by : Jyoti Lakhani
ACID Properties: ISOLATION
ISOLATION
Transaction data must not be available to other transactions
until the original transaction is committed or rolled back.
12-04-2019 11by : Jyoti Lakhani
ACID Properties: DURABILITY
DURABILITY
Transaction data changes must be available, even in the
event of database failure.
12-04-2019 12by : Jyoti Lakhani
To perform one task at same time by two objects
Concurrency
12-04-2019 13by : Jyoti Lakhani
Concurrent vs Parallel
CONCURRENCY  Sharing of Resources
12-04-2019 14by : Jyoti Lakhani
Concurrent vs Parallel
12-04-2019 15by : Jyoti Lakhani
CONCURRENCY
IS
A
PROBLEM
12-04-2019 16by : Jyoti Lakhani
Problems of Concurrency
12-04-2019 17by : Jyoti Lakhani
A=10
A= A+10 =20
A=20
A= A+10 =30
A=30
A=10
Problems of Concurrency: DIRTY READ
12-04-2019 18by : Jyoti Lakhani
Problems of Concurrency: UNEPEATED READ
12-04-2019 19by : Jyoti Lakhani
Problems of Concurrency: LOST UPDATE
12-04-2019 20by : Jyoti Lakhani
Problems of Concurrency: PHANTOM READ
12-04-2019 21by : Jyoti Lakhani
Problems of Concurrency
12-04-2019 22by : Jyoti Lakhani
Problems of Concurrency: LOST UPDATE
DEAD LOCK
12-04-2019 23by : Jyoti Lakhani
12-04-2019 24by : Jyoti Lakhani
Concurrency control is the procedure in DBMS for
managing simultaneous operations
without conflicting with each another
Concurrency Control: WHAT IS?
12-04-2019 25by : Jyoti Lakhani
Concurrency Control: PROTOCOLS
Concurrency Control Protocols
• Locking Protocol
•Two Phase Locking Protocol
•Time Stamp Protocol
12-04-2019 26by : Jyoti Lakhani
Concurrency Control: LOCKING PROTOCOL
Lock Data Items
A lock is a data variable which is associated with a data item
Locks helps to –
synchronize access to the database items
…. by concurrent transactions.
Transactions proceed only once the lock request is granted
Transactions proceed only once the lock request is granted
12-04-2019 27by : Jyoti Lakhani
12-04-2019 by : Jyoti Lakhani 28
Concurrency Control: LOCKING PROTOCOL
Concurrency Control: LOCKING PROTOCOL
• Binary Locks
• Shared/ Exclusive Locking
12-04-2019 29by : Jyoti Lakhani
Concurrency Control: LOCKING PROTOCOL
Binary Locking
A Binary lock on a data item can either locked or unlocked states
12-04-2019 30by : Jyoti Lakhani
Concurrency Control: LOCKING PROTOCOL
Shared / Exclusive Locks
This type of locking mechanism separates the locks based on
their uses.
Shared Lock (S)
Read-only lock
data item can be shared
between transactions
you will never have
permission to update data
a data item can be read as well
as written
Exclusive Lock (X)
This is exclusive and can't be held
concurrently on the same data
item
Transactions may unlock the data
item after finishing the 'write'
operation
12-04-2019 31by : Jyoti Lakhani
Concurrency Control: LOCKING PROTOCOL
12-04-2019 32by : Jyoti Lakhani
Concurrency Control: Locking Protocol
Problem with Locking Protocol
Starvation
Deadlock
Starvation is the situation when a transaction needs to wait for an indefinite
period to acquire a lock.
Deadlock refers to a specific situation where two or more processes are
waiting for each other to release a resource or more than two processes
are waiting for the resource in a circular chain.
12-04-2019 33by : Jyoti Lakhani
Concurrency Control: Two Phase Locking Protocol
This locking protocol divides the execution phase of a
transaction into three different parts
• Growing Phase
• Locked Phase
• Shrinking Phase
Growing Phase: In this phase transaction may obtain locks but may not release any
locks.
Shrinking Phase: In this phase, a transaction may release locks but not obtain any new
lock
12-04-2019 34by : Jyoti Lakhani
Concurrency Control: Two Phase Locking Protocol
12-04-2019 35by : Jyoti Lakhani
Strict Two-Phase Locking Method
Concurrency Control: Two Phase Locking Protocol
Transaction Hold Locks until end of the Transaction
12-04-2019 36by : Jyoti Lakhani
Concurrency Control: Two Phase Locking Protocol
12-04-2019 37by : Jyoti Lakhani
Concurrency Control: Time Stamp based Protocol
Uses a timestamp to serialize the execution of concurrent
transactions
This protocol ensures that every conflicting read and write
operations are executed in timestamp order.
The protocol uses the System Time or Logical Count as a
Timestamp.
12-04-2019 38by : Jyoti Lakhani
Concurrency Control: Time Stamp based Protocol
12-04-2019 39by : Jyoti Lakhani
In Time Stamp Protocol ensures that any conflicting read and write operations are
executed in time stamp order
if not such an operation is rejected and transaction will be rolled back.
The rolled back transaction will be restarted with a new Time Stamp.
Concurrency Control: Time Stamp based Protocol
12-04-2019 40by : Jyoti Lakhani
Concurrency Control: Time Stamp based Protocol
12-04-2019 41by : Jyoti Lakhani
Advantages
1. Serializability
2. Ensures freedom from dead lock
Disadvantage
Starvation may occur due to continuously
getting aborted and restarting the
transaction.
Concurrency Control: Time Stamp based Protocol
12-04-2019 42by : Jyoti Lakhani

More Related Content

Similar to Transactions and Concurrency control

Overview of Concurrency Control & Recovery in Distributed Databases
Overview of Concurrency Control & Recovery in Distributed DatabasesOverview of Concurrency Control & Recovery in Distributed Databases
Overview of Concurrency Control & Recovery in Distributed DatabasesMeghaj Mallick
 
Processing Semantically-Ordered Streams in Financial Services
Processing Semantically-Ordered Streams in Financial ServicesProcessing Semantically-Ordered Streams in Financial Services
Processing Semantically-Ordered Streams in Financial ServicesFlink Forward
 
Distributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency controlDistributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency controlbalamurugan.k Kalibalamurugan
 
Blockchain for Accounting & Assurance
Blockchain for Accounting & AssuranceBlockchain for Accounting & Assurance
Blockchain for Accounting & AssuranceEryk Budi Pratama
 
blockchain workshop - blockchain and oabcs - solutions
blockchain workshop - blockchain and oabcs - solutionsblockchain workshop - blockchain and oabcs - solutions
blockchain workshop - blockchain and oabcs - solutionsJuarez Junior
 
3 distributed transactions-cocurrency-query
3 distributed transactions-cocurrency-query3 distributed transactions-cocurrency-query
3 distributed transactions-cocurrency-queryM Rezaur Rahman
 
Cisco ICON Speaker Series: Blockchain - Technology that is revolutionizing th...
Cisco ICON Speaker Series: Blockchain - Technology that is revolutionizing th...Cisco ICON Speaker Series: Blockchain - Technology that is revolutionizing th...
Cisco ICON Speaker Series: Blockchain - Technology that is revolutionizing th...Vishnu Pendyala
 
Blockchain Applications for Large Enterprises by Austin Higgins
Blockchain Applications for Large Enterprises by Austin HigginsBlockchain Applications for Large Enterprises by Austin Higgins
Blockchain Applications for Large Enterprises by Austin HigginsAustin Higgins
 
Blockchain and High Tech: White Paper for SMTA
Blockchain and High Tech: White Paper for SMTABlockchain and High Tech: White Paper for SMTA
Blockchain and High Tech: White Paper for SMTAQuentin Samelson
 
InfiniteChain White Paper
InfiniteChain White Paper InfiniteChain White Paper
InfiniteChain White Paper InfiniteChain
 
IRJET- Blockchain Security Implementation for Financial Domains
IRJET- Blockchain Security Implementation for Financial DomainsIRJET- Blockchain Security Implementation for Financial Domains
IRJET- Blockchain Security Implementation for Financial DomainsIRJET Journal
 
Collaborative Business Process Execution on Blockchain: The Caterpillar Approach
Collaborative Business Process Execution on Blockchain: The Caterpillar ApproachCollaborative Business Process Execution on Blockchain: The Caterpillar Approach
Collaborative Business Process Execution on Blockchain: The Caterpillar ApproachMarlon Dumas
 
Locking base concurrency control
  Locking base concurrency control  Locking base concurrency control
Locking base concurrency controlPrakash Poudel
 
blockchain technology -unit-3-notes.pdf for engineering students
blockchain technology -unit-3-notes.pdf for engineering studentsblockchain technology -unit-3-notes.pdf for engineering students
blockchain technology -unit-3-notes.pdf for engineering studentsimranakhtar83
 
How blockchain can potentially replace traditional supply chain processes
How blockchain can potentially replace traditional supply chain processesHow blockchain can potentially replace traditional supply chain processes
How blockchain can potentially replace traditional supply chain processesBlockchain Council
 
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docxDBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docxrandyburney60861
 
Distributed Ledger Technologies for International Banking
Distributed Ledger Technologies for International BankingDistributed Ledger Technologies for International Banking
Distributed Ledger Technologies for International BankingEternic
 
Blockchain - to be or not to be
Blockchain - to be or not to beBlockchain - to be or not to be
Blockchain - to be or not to beSergey Khandogin
 

Similar to Transactions and Concurrency control (20)

Rdbms
RdbmsRdbms
Rdbms
 
Overview of Concurrency Control & Recovery in Distributed Databases
Overview of Concurrency Control & Recovery in Distributed DatabasesOverview of Concurrency Control & Recovery in Distributed Databases
Overview of Concurrency Control & Recovery in Distributed Databases
 
Processing Semantically-Ordered Streams in Financial Services
Processing Semantically-Ordered Streams in Financial ServicesProcessing Semantically-Ordered Streams in Financial Services
Processing Semantically-Ordered Streams in Financial Services
 
Distributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency controlDistributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency control
 
Blockchain for Accounting & Assurance
Blockchain for Accounting & AssuranceBlockchain for Accounting & Assurance
Blockchain for Accounting & Assurance
 
blockchain workshop - blockchain and oabcs - solutions
blockchain workshop - blockchain and oabcs - solutionsblockchain workshop - blockchain and oabcs - solutions
blockchain workshop - blockchain and oabcs - solutions
 
3 distributed transactions-cocurrency-query
3 distributed transactions-cocurrency-query3 distributed transactions-cocurrency-query
3 distributed transactions-cocurrency-query
 
Lec08
Lec08Lec08
Lec08
 
Cisco ICON Speaker Series: Blockchain - Technology that is revolutionizing th...
Cisco ICON Speaker Series: Blockchain - Technology that is revolutionizing th...Cisco ICON Speaker Series: Blockchain - Technology that is revolutionizing th...
Cisco ICON Speaker Series: Blockchain - Technology that is revolutionizing th...
 
Blockchain Applications for Large Enterprises by Austin Higgins
Blockchain Applications for Large Enterprises by Austin HigginsBlockchain Applications for Large Enterprises by Austin Higgins
Blockchain Applications for Large Enterprises by Austin Higgins
 
Blockchain and High Tech: White Paper for SMTA
Blockchain and High Tech: White Paper for SMTABlockchain and High Tech: White Paper for SMTA
Blockchain and High Tech: White Paper for SMTA
 
InfiniteChain White Paper
InfiniteChain White Paper InfiniteChain White Paper
InfiniteChain White Paper
 
IRJET- Blockchain Security Implementation for Financial Domains
IRJET- Blockchain Security Implementation for Financial DomainsIRJET- Blockchain Security Implementation for Financial Domains
IRJET- Blockchain Security Implementation for Financial Domains
 
Collaborative Business Process Execution on Blockchain: The Caterpillar Approach
Collaborative Business Process Execution on Blockchain: The Caterpillar ApproachCollaborative Business Process Execution on Blockchain: The Caterpillar Approach
Collaborative Business Process Execution on Blockchain: The Caterpillar Approach
 
Locking base concurrency control
  Locking base concurrency control  Locking base concurrency control
Locking base concurrency control
 
blockchain technology -unit-3-notes.pdf for engineering students
blockchain technology -unit-3-notes.pdf for engineering studentsblockchain technology -unit-3-notes.pdf for engineering students
blockchain technology -unit-3-notes.pdf for engineering students
 
How blockchain can potentially replace traditional supply chain processes
How blockchain can potentially replace traditional supply chain processesHow blockchain can potentially replace traditional supply chain processes
How blockchain can potentially replace traditional supply chain processes
 
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docxDBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
 
Distributed Ledger Technologies for International Banking
Distributed Ledger Technologies for International BankingDistributed Ledger Technologies for International Banking
Distributed Ledger Technologies for International Banking
 
Blockchain - to be or not to be
Blockchain - to be or not to beBlockchain - to be or not to be
Blockchain - to be or not to be
 

More from jyoti_lakhani

CG02 Computer Graphic Systems.ppsx
CG02 Computer Graphic Systems.ppsxCG02 Computer Graphic Systems.ppsx
CG02 Computer Graphic Systems.ppsxjyoti_lakhani
 
CG04 Color Models.ppsx
CG04 Color Models.ppsxCG04 Color Models.ppsx
CG04 Color Models.ppsxjyoti_lakhani
 
CG03 Random Raster Scan displays and Color CRTs.ppsx
CG03 Random Raster Scan displays and Color CRTs.ppsxCG03 Random Raster Scan displays and Color CRTs.ppsx
CG03 Random Raster Scan displays and Color CRTs.ppsxjyoti_lakhani
 
CG02 Computer Graphic Systems.pptx
CG02 Computer Graphic Systems.pptxCG02 Computer Graphic Systems.pptx
CG02 Computer Graphic Systems.pptxjyoti_lakhani
 
CG01 introduction.ppsx
CG01 introduction.ppsxCG01 introduction.ppsx
CG01 introduction.ppsxjyoti_lakhani
 
Tree terminology and introduction to binary tree
Tree terminology and introduction to binary treeTree terminology and introduction to binary tree
Tree terminology and introduction to binary treejyoti_lakhani
 
Ds006 linked list- delete from front
Ds006   linked list- delete from frontDs006   linked list- delete from front
Ds006 linked list- delete from frontjyoti_lakhani
 
Ds06 linked list- insert a node after a given node
Ds06   linked list-  insert a node after a given nodeDs06   linked list-  insert a node after a given node
Ds06 linked list- insert a node after a given nodejyoti_lakhani
 
Ds06 linked list- insert a node at end
Ds06   linked list- insert a node at endDs06   linked list- insert a node at end
Ds06 linked list- insert a node at endjyoti_lakhani
 
Ds06 linked list- insert a node at beginning
Ds06   linked list- insert a node at beginningDs06   linked list- insert a node at beginning
Ds06 linked list- insert a node at beginningjyoti_lakhani
 
Ds06 linked list- intro and create a node
Ds06   linked list- intro and create a nodeDs06   linked list- intro and create a node
Ds06 linked list- intro and create a nodejyoti_lakhani
 
Ds04 abstract data types (adt) jyoti lakhani
Ds04 abstract data types (adt) jyoti lakhaniDs04 abstract data types (adt) jyoti lakhani
Ds04 abstract data types (adt) jyoti lakhanijyoti_lakhani
 
Ds03 part i algorithms by jyoti lakhani
Ds03 part i algorithms   by jyoti lakhaniDs03 part i algorithms   by jyoti lakhani
Ds03 part i algorithms by jyoti lakhanijyoti_lakhani
 
Ds03 algorithms jyoti lakhani
Ds03 algorithms jyoti lakhaniDs03 algorithms jyoti lakhani
Ds03 algorithms jyoti lakhanijyoti_lakhani
 
Ds02 flow chart and pseudo code
Ds02 flow chart and pseudo codeDs02 flow chart and pseudo code
Ds02 flow chart and pseudo codejyoti_lakhani
 
Ds01 data structure introduction - by jyoti lakhani
Ds01 data structure  introduction - by jyoti lakhaniDs01 data structure  introduction - by jyoti lakhani
Ds01 data structure introduction - by jyoti lakhanijyoti_lakhani
 

More from jyoti_lakhani (20)

CG02 Computer Graphic Systems.ppsx
CG02 Computer Graphic Systems.ppsxCG02 Computer Graphic Systems.ppsx
CG02 Computer Graphic Systems.ppsx
 
Projections.pptx
Projections.pptxProjections.pptx
Projections.pptx
 
CG04 Color Models.ppsx
CG04 Color Models.ppsxCG04 Color Models.ppsx
CG04 Color Models.ppsx
 
CG03 Random Raster Scan displays and Color CRTs.ppsx
CG03 Random Raster Scan displays and Color CRTs.ppsxCG03 Random Raster Scan displays and Color CRTs.ppsx
CG03 Random Raster Scan displays and Color CRTs.ppsx
 
CG02 Computer Graphic Systems.pptx
CG02 Computer Graphic Systems.pptxCG02 Computer Graphic Systems.pptx
CG02 Computer Graphic Systems.pptx
 
CG01 introduction.ppsx
CG01 introduction.ppsxCG01 introduction.ppsx
CG01 introduction.ppsx
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked list
 
Double ended queue
Double ended queueDouble ended queue
Double ended queue
 
Tree terminology and introduction to binary tree
Tree terminology and introduction to binary treeTree terminology and introduction to binary tree
Tree terminology and introduction to binary tree
 
Priority queue
Priority queuePriority queue
Priority queue
 
Ds006 linked list- delete from front
Ds006   linked list- delete from frontDs006   linked list- delete from front
Ds006 linked list- delete from front
 
Ds06 linked list- insert a node after a given node
Ds06   linked list-  insert a node after a given nodeDs06   linked list-  insert a node after a given node
Ds06 linked list- insert a node after a given node
 
Ds06 linked list- insert a node at end
Ds06   linked list- insert a node at endDs06   linked list- insert a node at end
Ds06 linked list- insert a node at end
 
Ds06 linked list- insert a node at beginning
Ds06   linked list- insert a node at beginningDs06   linked list- insert a node at beginning
Ds06 linked list- insert a node at beginning
 
Ds06 linked list- intro and create a node
Ds06   linked list- intro and create a nodeDs06   linked list- intro and create a node
Ds06 linked list- intro and create a node
 
Ds04 abstract data types (adt) jyoti lakhani
Ds04 abstract data types (adt) jyoti lakhaniDs04 abstract data types (adt) jyoti lakhani
Ds04 abstract data types (adt) jyoti lakhani
 
Ds03 part i algorithms by jyoti lakhani
Ds03 part i algorithms   by jyoti lakhaniDs03 part i algorithms   by jyoti lakhani
Ds03 part i algorithms by jyoti lakhani
 
Ds03 algorithms jyoti lakhani
Ds03 algorithms jyoti lakhaniDs03 algorithms jyoti lakhani
Ds03 algorithms jyoti lakhani
 
Ds02 flow chart and pseudo code
Ds02 flow chart and pseudo codeDs02 flow chart and pseudo code
Ds02 flow chart and pseudo code
 
Ds01 data structure introduction - by jyoti lakhani
Ds01 data structure  introduction - by jyoti lakhaniDs01 data structure  introduction - by jyoti lakhani
Ds01 data structure introduction - by jyoti lakhani
 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 

Recently uploaded (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

Transactions and Concurrency control

  • 1. Transaction A transaction is a unit of work performed within a database Transaction is a logical unit that is independently executed for data retrieval or updates Transactions are represented as Schedules t0 t1 t2 t3 t4 12-04-2019 1by : Jyoti Lakhani
  • 2. States of a Transaction 12-04-2019 2by : Jyoti Lakhani
  • 3. SQL Transaction is helpful to execute one more statements as a set. SQL Transaction 12-04-2019 3by : Jyoti Lakhani
  • 4. States of a Transaction: COMMIT 12-04-2019 4by : Jyoti Lakhani
  • 5. States of a Transaction: ROLLBACK 12-04-2019 5by : Jyoti Lakhani
  • 6. Complete life cycle of a Transaction 12-04-2019 6by : Jyoti Lakhani
  • 7. Properties of a Transaction 12-04-2019 7by : Jyoti Lakhani
  • 9. ACID Properties: ATOMICITY ATOMICITY A transaction must be fully complete, saved (committed) or completely undone (rolled back). Begin Commit RollBack ALL NONE12-04-2019 9by : Jyoti Lakhani
  • 10. ACID Properties: CONSISTANCY CONSISTENCY The transaction must be fully compliant with the state of the database as it was prior to the transaction CONSISTENCY INCONSISTENCY 12-04-2019 10by : Jyoti Lakhani
  • 11. ACID Properties: ISOLATION ISOLATION Transaction data must not be available to other transactions until the original transaction is committed or rolled back. 12-04-2019 11by : Jyoti Lakhani
  • 12. ACID Properties: DURABILITY DURABILITY Transaction data changes must be available, even in the event of database failure. 12-04-2019 12by : Jyoti Lakhani
  • 13. To perform one task at same time by two objects Concurrency 12-04-2019 13by : Jyoti Lakhani
  • 14. Concurrent vs Parallel CONCURRENCY  Sharing of Resources 12-04-2019 14by : Jyoti Lakhani
  • 15. Concurrent vs Parallel 12-04-2019 15by : Jyoti Lakhani
  • 17. Problems of Concurrency 12-04-2019 17by : Jyoti Lakhani
  • 18. A=10 A= A+10 =20 A=20 A= A+10 =30 A=30 A=10 Problems of Concurrency: DIRTY READ 12-04-2019 18by : Jyoti Lakhani
  • 19. Problems of Concurrency: UNEPEATED READ 12-04-2019 19by : Jyoti Lakhani
  • 20. Problems of Concurrency: LOST UPDATE 12-04-2019 20by : Jyoti Lakhani
  • 21. Problems of Concurrency: PHANTOM READ 12-04-2019 21by : Jyoti Lakhani
  • 22. Problems of Concurrency 12-04-2019 22by : Jyoti Lakhani
  • 23. Problems of Concurrency: LOST UPDATE DEAD LOCK 12-04-2019 23by : Jyoti Lakhani
  • 24. 12-04-2019 24by : Jyoti Lakhani
  • 25. Concurrency control is the procedure in DBMS for managing simultaneous operations without conflicting with each another Concurrency Control: WHAT IS? 12-04-2019 25by : Jyoti Lakhani
  • 26. Concurrency Control: PROTOCOLS Concurrency Control Protocols • Locking Protocol •Two Phase Locking Protocol •Time Stamp Protocol 12-04-2019 26by : Jyoti Lakhani
  • 27. Concurrency Control: LOCKING PROTOCOL Lock Data Items A lock is a data variable which is associated with a data item Locks helps to – synchronize access to the database items …. by concurrent transactions. Transactions proceed only once the lock request is granted Transactions proceed only once the lock request is granted 12-04-2019 27by : Jyoti Lakhani
  • 28. 12-04-2019 by : Jyoti Lakhani 28 Concurrency Control: LOCKING PROTOCOL
  • 29. Concurrency Control: LOCKING PROTOCOL • Binary Locks • Shared/ Exclusive Locking 12-04-2019 29by : Jyoti Lakhani
  • 30. Concurrency Control: LOCKING PROTOCOL Binary Locking A Binary lock on a data item can either locked or unlocked states 12-04-2019 30by : Jyoti Lakhani
  • 31. Concurrency Control: LOCKING PROTOCOL Shared / Exclusive Locks This type of locking mechanism separates the locks based on their uses. Shared Lock (S) Read-only lock data item can be shared between transactions you will never have permission to update data a data item can be read as well as written Exclusive Lock (X) This is exclusive and can't be held concurrently on the same data item Transactions may unlock the data item after finishing the 'write' operation 12-04-2019 31by : Jyoti Lakhani
  • 32. Concurrency Control: LOCKING PROTOCOL 12-04-2019 32by : Jyoti Lakhani
  • 33. Concurrency Control: Locking Protocol Problem with Locking Protocol Starvation Deadlock Starvation is the situation when a transaction needs to wait for an indefinite period to acquire a lock. Deadlock refers to a specific situation where two or more processes are waiting for each other to release a resource or more than two processes are waiting for the resource in a circular chain. 12-04-2019 33by : Jyoti Lakhani
  • 34. Concurrency Control: Two Phase Locking Protocol This locking protocol divides the execution phase of a transaction into three different parts • Growing Phase • Locked Phase • Shrinking Phase Growing Phase: In this phase transaction may obtain locks but may not release any locks. Shrinking Phase: In this phase, a transaction may release locks but not obtain any new lock 12-04-2019 34by : Jyoti Lakhani
  • 35. Concurrency Control: Two Phase Locking Protocol 12-04-2019 35by : Jyoti Lakhani
  • 36. Strict Two-Phase Locking Method Concurrency Control: Two Phase Locking Protocol Transaction Hold Locks until end of the Transaction 12-04-2019 36by : Jyoti Lakhani
  • 37. Concurrency Control: Two Phase Locking Protocol 12-04-2019 37by : Jyoti Lakhani
  • 38. Concurrency Control: Time Stamp based Protocol Uses a timestamp to serialize the execution of concurrent transactions This protocol ensures that every conflicting read and write operations are executed in timestamp order. The protocol uses the System Time or Logical Count as a Timestamp. 12-04-2019 38by : Jyoti Lakhani
  • 39. Concurrency Control: Time Stamp based Protocol 12-04-2019 39by : Jyoti Lakhani
  • 40. In Time Stamp Protocol ensures that any conflicting read and write operations are executed in time stamp order if not such an operation is rejected and transaction will be rolled back. The rolled back transaction will be restarted with a new Time Stamp. Concurrency Control: Time Stamp based Protocol 12-04-2019 40by : Jyoti Lakhani
  • 41. Concurrency Control: Time Stamp based Protocol 12-04-2019 41by : Jyoti Lakhani
  • 42. Advantages 1. Serializability 2. Ensures freedom from dead lock Disadvantage Starvation may occur due to continuously getting aborted and restarting the transaction. Concurrency Control: Time Stamp based Protocol 12-04-2019 42by : Jyoti Lakhani