SlideShare ist ein Scribd-Unternehmen logo
1 von 15
Transactions
Introduction

Jennifer Widom
Motivated by two independent requirements

Transactions

 Concurrent database access
 Resilience to system failures

Jennifer Widom
Transactions

Concurrent Database Access
Even more software

More software

DBMS

Select…
Update…
Create Table…
Drop Index…
Help…
Delete…

Data

Jennifer Widom
Concurrent Access: Attribute-level Inconsistency Transactions
Update College Set enrollment = enrollment + 1000
Where cName = ‘Stanford’

concurrent with …
Update College Set enrollment = enrollment + 1500
Where cName = ‘Stanford’

Jennifer Widom
Concurrent Access: Tuple-level Inconsistency

Transactions

Update Apply Set major = ‘CS’ Where sID = 123

concurrent with …
Update Apply Set decision = ‘Y’ Where sID = 123

Jennifer Widom
Concurrent Access: Table-level Inconsistency

Transactions

Update Apply Set decision = ‘Y’
Where sID In (Select sID From Student Where GPA > 3.9)

concurrent with …
Update Student Set GPA = (1.1)  GPA Where sizeHS > 2500

Jennifer Widom
Concurrent Access: Multi-statement inconsistency Transactions
Insert Into Archive
Select * From Apply Where decision = ‘N’;
Delete From Apply Where decision = ‘N’;

concurrent with …
Select Count(*) From Apply;
Select Count(*) From Archive;

Jennifer Widom
Concurrency Goal

Transactions

Execute sequence of SQL statements so they appear
to be running in isolation
 Simple solution: execute them in isolation
But want to enable concurrency whenever safe to do so

Jennifer Widom
Resilience to System Failures

Transactions

Bulk Load

DBMS
Data

Jennifer Widom
Resilience to System Failures

Transactions

Insert Into Archive
Select * From Apply Where decision = ‘N’;
Delete From Apply Where decision = ‘N’;

DBMS
Data

Jennifer Widom
Resilience to System Failures

Transactions

Lots of updates
buffered in memory

DBMS
Data

Jennifer Widom
System-Failure Goal
Guarantee all-or-nothing execution, regardless
of failures

Transactions

DBMS
Data

Jennifer Widom
Solution for both concurrency and failures

Transactions

Transactions
A transaction is a sequence of one or more SQL
operations treated as a unit
 Transactions appear to run in isolation
 If the system fails, each transaction’s changes are
reflected either entirely or not at all

Jennifer Widom
Solution for both concurrency and failures

Transactions

Transactions
A transaction is a sequence of one or more SQL
operations treated as a unit. SQL standard:





Transaction begins automatically on first SQL statement
On “commit” transaction ends and new one begins
Current transaction ends on session termination
“Autocommit” turns each statement into transaction
Jennifer Widom
Solution for both concurrency and failures

Transactions

Transactions
A transaction is a sequence of one or more SQL
operations treated as a unit

Jennifer Widom

Weitere ähnliche Inhalte

Andere mochten auch (12)

Crm 002
Crm 002Crm 002
Crm 002
 
Ch15
Ch15Ch15
Ch15
 
Superlative
SuperlativeSuperlative
Superlative
 
5 estruturas de controle
5 estruturas de controle5 estruturas de controle
5 estruturas de controle
 
The Most effective models for Customer Support Operations
The Most effective models for Customer Support OperationsThe Most effective models for Customer Support Operations
The Most effective models for Customer Support Operations
 
Retail Idea
Retail IdeaRetail Idea
Retail Idea
 
คุฏบะฮฺ อีดิลฟิฏริ ฮ.ศ. 1436
คุฏบะฮฺ อีดิลฟิฏริ ฮ.ศ. 1436คุฏบะฮฺ อีดิลฟิฏริ ฮ.ศ. 1436
คุฏบะฮฺ อีดิลฟิฏริ ฮ.ศ. 1436
 
Affordable Taiwan Travel
Affordable Taiwan TravelAffordable Taiwan Travel
Affordable Taiwan Travel
 
Aprendiendo java
Aprendiendo javaAprendiendo java
Aprendiendo java
 
final resume
final resumefinal resume
final resume
 
CAP and BASE
CAP and BASECAP and BASE
CAP and BASE
 
2 d0106 ma evaluacion
2 d0106 ma evaluacion2 d0106 ma evaluacion
2 d0106 ma evaluacion
 

Kürzlich hochgeladen

Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 

Kürzlich hochgeladen (20)

Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 

Transactions introduction

  • 2. Motivated by two independent requirements Transactions  Concurrent database access  Resilience to system failures Jennifer Widom
  • 3. Transactions Concurrent Database Access Even more software More software DBMS Select… Update… Create Table… Drop Index… Help… Delete… Data Jennifer Widom
  • 4. Concurrent Access: Attribute-level Inconsistency Transactions Update College Set enrollment = enrollment + 1000 Where cName = ‘Stanford’ concurrent with … Update College Set enrollment = enrollment + 1500 Where cName = ‘Stanford’ Jennifer Widom
  • 5. Concurrent Access: Tuple-level Inconsistency Transactions Update Apply Set major = ‘CS’ Where sID = 123 concurrent with … Update Apply Set decision = ‘Y’ Where sID = 123 Jennifer Widom
  • 6. Concurrent Access: Table-level Inconsistency Transactions Update Apply Set decision = ‘Y’ Where sID In (Select sID From Student Where GPA > 3.9) concurrent with … Update Student Set GPA = (1.1)  GPA Where sizeHS > 2500 Jennifer Widom
  • 7. Concurrent Access: Multi-statement inconsistency Transactions Insert Into Archive Select * From Apply Where decision = ‘N’; Delete From Apply Where decision = ‘N’; concurrent with … Select Count(*) From Apply; Select Count(*) From Archive; Jennifer Widom
  • 8. Concurrency Goal Transactions Execute sequence of SQL statements so they appear to be running in isolation  Simple solution: execute them in isolation But want to enable concurrency whenever safe to do so Jennifer Widom
  • 9. Resilience to System Failures Transactions Bulk Load DBMS Data Jennifer Widom
  • 10. Resilience to System Failures Transactions Insert Into Archive Select * From Apply Where decision = ‘N’; Delete From Apply Where decision = ‘N’; DBMS Data Jennifer Widom
  • 11. Resilience to System Failures Transactions Lots of updates buffered in memory DBMS Data Jennifer Widom
  • 12. System-Failure Goal Guarantee all-or-nothing execution, regardless of failures Transactions DBMS Data Jennifer Widom
  • 13. Solution for both concurrency and failures Transactions Transactions A transaction is a sequence of one or more SQL operations treated as a unit  Transactions appear to run in isolation  If the system fails, each transaction’s changes are reflected either entirely or not at all Jennifer Widom
  • 14. Solution for both concurrency and failures Transactions Transactions A transaction is a sequence of one or more SQL operations treated as a unit. SQL standard:     Transaction begins automatically on first SQL statement On “commit” transaction ends and new one begins Current transaction ends on session termination “Autocommit” turns each statement into transaction Jennifer Widom
  • 15. Solution for both concurrency and failures Transactions Transactions A transaction is a sequence of one or more SQL operations treated as a unit Jennifer Widom