{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

trans-view-index - Transactions,Views,Indexes 1...

Info icon This preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Transactions, Views, Indexes Controlling Concurrent Behavior Virtual and Materialized Views Speeding Accesses to Data
Image of page 1

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

View Full Document Right Arrow Icon
2 Why Transactions? Database systems are normally being  accessed by many users or processes  at the same time. Both queries and modifications. Unlike operating systems, which  support   interaction of processes, a  DMBS needs to keep processes from  troublesome interactions.
Image of page 2
3 Example : Bad Interaction You and your domestic partner each  take $100 from different ATM’s at about  the same time. The DBMS better make sure one account  deduction doesn’t get lost. Compare : An OS allows two people to  edit a document at the same time.  If  both write, one’s changes get lost.
Image of page 3

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

View Full Document Right Arrow Icon
4 Transactions Transaction   = process involving  database queries and/or modification. Normally with some strong properties  regarding concurrency. Formed in SQL from single statements  or explicit programmer control.
Image of page 4
5 ACID Transactions ACID transactions   are: Atomic  : Whole transaction or none is done. Consistent  : Database constraints preserved. Isolated  : It appears to the user as if only one  process executes at a time. Durable   : Effects of a process survive a crash. Optional : weaker forms of transactions are  often supported as well.
Image of page 5

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

View Full Document Right Arrow Icon
6 COMMIT The SQL statement COMMIT causes a  transaction to complete. It’s database modifications are now  permanent in the database.
Image of page 6
7 ROLLBACK The SQL statement ROLLBACK also  causes the transaction to end, but by  aborting . No effects on the database. Failures like division by 0 or a  constraint violation can also cause  rollback, even if the programmer does  not request it.
Image of page 7

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

View Full Document Right Arrow Icon
8 Example : Interacting Processes Assume the usual  Sells(bar,beer,price)   relation, and suppose that Joe’s Bar sells  only Bud for $2.50 and Miller for $3.00. Sally is querying  Sells  for the highest and  lowest price Joe charges. Joe decides to stop selling Bud and  Miller, but to sell only Heineken at $3.50.
Image of page 8
9 Sally’s Program Sally executes the following two SQL  statements called  (min)  and  (max)  to  help us remember what they do. (max) SELECT MAX(price) FROM  Sells WHERE bar = ’Joe’’s Bar’; (min) SELECT MIN(price) FROM  Sells WHERE bar = ’Joe’’s Bar’;
Image of page 9

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

View Full Document Right Arrow Icon
10 Joe’s Program At about the same time, Joe executes the  following steps:  (del)  and  (ins) . (del)   DELETE FROM Sells   WHERE bar = ’Joe’’s Bar’; (ins)   INSERT INTO Sells   VALUES(’Joe’’s Bar’, ’Heineken’, 3.50);
Image of page 10
11 Interleaving of Statements Although  (max)  must come before  (min) , and  (del)  must come before  (ins) there are no other constraints on the  order of these statements, unless we  group Sally’s and/or Joe’s statements  into transactions.
Image of page 11

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern