cs411-10-tranmgr-2 - 1 CS411 Database Systems 10...

Info iconThis preview shows pages 1–14. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 CS411 Database Systems 10: Transaction Management 2 2 Why Do We Learn This? • SQL query = single statement • Transaction = Database program 2 3 Outline • Transaction management – motivation & brief introduction – major issues • recovery • concurrency control • Recovery 4 Users and DB Programs • End users don't see the DB directly – are only vaguely aware of its design – may be acutely aware of part of its contents – SQL is not a suitable end-user interface • A single SQL query is not a sufficient unit of DB work – May need more than one query – May need to check constraints not enforced by the DBMS – May need to do calculations, realize “business rules”, etc. 5 Users and DB Programs • Ergo, a program is needed to carry out each unit of DB work • End users interact with DB programs – Rather than SQL – May be many users simultaneously • Thus many simultaneous executions of these programs – Each user expects service and correct operation • A user should not have to wait forever • A user should not be affected by errors of others 6 Definition of "Transaction" Definition: A transaction is the execution of a DB program. • DB applications are designed as a set of transactions • Typical transaction – starts with data from user or from another transaction – includes DB reads/writes – ends with display of data or form, or with request to start another transaction 7 8 And He is a Key Contributor From: Jim Gray at IBM: the transaction processing revolution. Bruce G. Lindsay. ACM SIGMOD Record. 37(2). June 2008. 9 Atomicity • Transactions must be "atomic" – Their effect is all or none – DB must be consistent before and after the transaction executes (not necessarily during!) • EITHER – a transaction executes fully and "commits" to all the changes it makes to the DB – OR it must be as though that transaction never executed at all 10 A Typical Transaction • User view: “Transfer money from savings to checking” • Program: – read savings; – verify balance is adequate; – update savings balance; – read checking; – update checking balance; 11 "Commit" and "Abort" • A transactions which only READs expects DB to be consistent, and cannot cause it to become otherwise. • When a transaction which does any WRITE finishes, it must either – COMMIT : "I'm done and the DB is consistent again" OR – ABORT (ROLLBACK) : "I'm done but I goofed: my changes must be undone." 12 Complications • A DB may have many simultaneous users – simultaneous users implies simultaneous transactions implies simultaneous DB access • multiprogramming/multiprocessing • Things can go wrong! – transactions can conflict with one another – programs may crash, OS may crash, disk may crash • company loses customer, gets sued, goes bankrupt, etc. 13 But DB Must Not Crash • Can't be allowed to become inconsistent – A DB that's 1% inaccurate is 100% unusable....
View Full Document

{[ snackBarMessage ]}

Page1 / 56

cs411-10-tranmgr-2 - 1 CS411 Database Systems 10...

This preview shows document pages 1 - 14. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online