Transactions introduction

247 views
187 views

Published on

Transactions introduction
Advance data base management System

Published in: Education, Technology, Real Estate
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
247
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transactions introduction

  1. 1. Transactions Introduction Jennifer Widom
  2. 2. Motivated by two independent requirements Transactions  Concurrent database access  Resilience to system failures Jennifer Widom
  3. 3. Transactions Concurrent Database Access Even more software More software DBMS Select… Update… Create Table… Drop Index… Help… Delete… Data Jennifer Widom
  4. 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. 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. 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. 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. 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. 9. Resilience to System Failures Transactions Bulk Load DBMS Data Jennifer Widom
  10. 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. 11. Resilience to System Failures Transactions Lots of updates buffered in memory DBMS Data Jennifer Widom
  12. 12. System-Failure Goal Guarantee all-or-nothing execution, regardless of failures Transactions DBMS Data Jennifer Widom
  13. 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. 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. 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

×