17-transaction

17-transaction - Announcements(Tue Nov 8 SQL Transactions...

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

View Full Document Right Arrow Icon
1 SQL: Transactions CPS 116 Introduction to Database Systems 2 Announcements (Tue. Nov. 8) Homework #3 due today! Project milestone #2 due Thursday 3 Transactions A transaction is a sequence of database operations with the following properties (ACID): Atomic: Operations of a transaction are executed all-or- nothing, and are never left “half-done” Consistency: Assume all database constraints are satisfied at the start of a transaction, they should remain satisfied at the end of the transaction Isolation: Transactions must behave as if they were executed in complete isolation from each other Durability: If the DBMS crashes after a transaction commits, all effects of the transaction must remain in the database when DBMS comes back up 4 SQL transactions A transaction is automatically started when a user executes an SQL statement Subsequent statements in the same session are executed as part of this transaction Statements see changes made by earlier ones in the same transaction Statements in other concurrently running transactions do not COMMIT command commits the transaction Its effects are made final and visible to subsequent transactions ROLLBACK command aborts the transaction Its effects are undone 5 Fine prints Schema operations (e.g., CREATETABLE ) implicitly commit the current transaction Because it is often difficult to undo a schema operation Many DBMS support an AUTOCOMMIT feature, which automatically commits every single statement You can turn it on/off through the API (e.g., JDBC) • Examples later in this lecture For PostgreSQL: psql command-line processor turns it on by default • You can turn it off at the psql
Image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
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