Revision Lecture Database Systems Michael Pound Stanislava Armstrong.

Slides:



Advertisements
Similar presentations
Introduction to Database Systems1 Concurrency Control CC.Lecture 1.
Advertisements

Transactions Chapter 6.1 V3.1 Napier University Dr Gordon Russell.
TRANSACTION PROCESSING SYSTEM ROHIT KHOKHER. TRANSACTION RECOVERY TRANSACTION RECOVERY TRANSACTION STATES SERIALIZABILITY CONFLICT SERIALIZABILITY VIEW.
Principles of Transaction Management. Outline Transaction concepts & protocols Performance impact of concurrency control Performance tuning.
Lecture 12 Transactions: Isolation. Transactions What’s hard? – ACID – Concurrency control – Recovery.
CSC271 Database Systems Lecture # 32.
Lock-Based Concurrency Control
IDA / ADIT Databasteknik Databaser och bioinformatik Transaction Fang Wei-Kleiner.
Lecture 11 Recoverability. 2 Serializability identifies schedules that maintain database consistency, assuming no transaction fails. Could also examine.
Concurrency Control and Recovery In real life: users access the database concurrently, and systems crash. Concurrent access to the database also improves.
Transaction Management and Concurrency Control
Quick Review of May 1 material Concurrent Execution and Serializability –inconsistent concurrent schedules –transaction conflicts serializable == conflict.
Transaction Management and Concurrency Control
Transaction Management and Concurrency Control
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
©Silberschatz, Korth and Sudarshan15.1Database System ConceptsTransactions Transaction Concept Transaction State Implementation of Atomicity and Durability.
What is a Transaction? Logical unit of work
Transaction Management
DBMS Software Week 7 –Conceptual Architecture - Ch 4 –Software Architecture - Ch 4 –Toolkit - Ch 11,12,13 –Kernel Ch 14, 15, 16, 17.
1 Minggu 8, Pertemuan 15 Transaction Management Matakuliah: T0206-Sistem Basisdata Tahun: 2005 Versi: 1.0/0.0.
Database Management Systems I Alex Coman, Winter 2006
Transactions Amol Deshpande CMSC424. Today Project stuff… Summer Internships 
9 Chapter 9 Transaction Management and Concurrency Control Hachim Haddouti.
Database Administration Part 1 Chapter Six CSCI260 Database Applications.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
Transactions and Recovery
1 IT420: Database Management and Organization Transactions 31 March 2006 Adina Crăiniceanu
08_Transactions_LECTURE2 DBMSs should guarantee ACID properties (Atomicity, Consistency, Isolation, Durability). This is typically done by guaranteeing.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 10 Transaction Management.
Dr Gordon Russell, Napier University Unit Concurrency 1 Transactions Unit 4.1.
Databases Illuminated
ITEC 3220M Using and Designing Database Systems Instructor: Prof. Z. Yang Course Website: 3220m.htm
IDA / ADIT Lecture 9: Transactions and concurrency control Jose M. Peña
1 Transactions Chapter Transactions A transaction is: a logical unit of work a sequence of steps to accomplish a single task Can have multiple.
Module Coordinator Tan Szu Tak School of Information and Communication Technology, Politeknik Brunei Semester
Transactions and Concurrency Control Distribuerade Informationssystem, 1DT060, HT 2013 Adapted from, Copyright, Frederik Hermans.
11/7/2012ISC329 Isabelle Bichindaritz1 Transaction Management & Concurrency Control.
©Silberschatz, Korth and Sudarshan15.1Database System Concepts Chapter 15: Transactions Transaction Concept Transaction State Implementation of Atomicity.
Transactions. What is it? Transaction - a logical unit of database processing Motivation - want consistent change of state in data Transactions developed.
Sekolah Tinggi Ilmu Statistik (STIS) 1 Dr. Said Mirza Pahlevi, M.Eng.
II.I Selected Database Issues: 2 - Transaction ManagementSlide 1/20 1 II. Selected Database Issues Part 2: Transaction Management Lecture 4 Lecturer: Chris.
The Relational Model1 Transaction Processing Units of Work.
Chapter 20 Transaction Management Thomas Connolly, Carolyn Begg, Database System, A Practical Approach to Design Implementation and Management, 4 th Edition,
CSC 240 (Blum)1 Database Transactions. CSC 240 (Blum)2 Transaction  A transaction is an interaction between a user (or application) and a database. A.
Transaction Management Transparencies. ©Pearson Education 2009 Chapter 14 - Objectives Function and importance of transactions. Properties of transactions.
CSC 411/511: DBMS Design Dr. Nan WangCSC411_L12_JDBC_MySQL 1 Transations.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 14: Transactions.
1 Advanced Database Concepts Transaction Management and Concurrency Control.
1 Lecture 4: Transaction Serialization and Concurrency Control Advanced Databases CG096 Nick Rossiter [Emma-Jane Phillips-Tait]
NOEA/IT - FEN: Databases/Transactions1 Transactions ACID Concurrency Control.
Lecture 8 Transactions & Concurrency UFCE8K-15-M: Data Management.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
©Bob Godfrey, 2002, 2005 Lecture 17: Transaction Integrity and Concurrency BSA206 Database Management Systems.
3 Database Systems: Design, Implementation, and Management CHAPTER 9 Transaction Management and Concurrency Control.
Jinze Liu. ACID Atomicity: TX’s are either completely done or not done at all Consistency: TX’s should leave the database in a consistent state Isolation:
Advanced Database CS-426 Week 6 – Transaction. Transactions and Recovery Transactions A transaction is an action, or a series of actions, carried out.
H.Lu/HKUST L06: Concurrency Control & Locking. L06: Concurrency Control & Locking - 2 H.Lu/HKUST Transactions  Concurrent execution of user programs.
Distributed Transactions What is a transaction? (A sequence of server operations that must be carried out atomically ) ACID properties - what are these.
Chapter 13 Managing Transactions and Concurrency Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
SYSTEMS IMPLEMENTATION TECHNIQUES TRANSACTION PROCESSING DATABASE RECOVERY DATABASE SECURITY CONCURRENCY CONTROL.
1 Concurrency Control. 2 Why Have Concurrent Processes? v Better transaction throughput, response time v Done via better utilization of resources: –While.
Transaction Management
Transaction Management and Concurrency Control
Database Management System
Transaction Management
Transaction Properties
Concurrency.
Chapter 10 Transaction Management and Concurrency Control
Introduction of Week 13 Return assignment 11-1 and 3-1-5
Transaction management
Presentation transcript:

Revision Lecture Database Systems Michael Pound Stanislava Armstrong

Final Lecture Part 1: SEM feedback Part 2: The Exam!!! Part 3: Normalization Part 4: Transactions and concurrency revision

Module Feedback

...and the survey says... First of all: Thanks for the great feedback! 26 people gave feedback about the module Majority were happy with how it is being taught – lots of ‘Strongly agree’ and ‘Agree’ But apart from that: 19% disagreed that the module helped their communication skills 2 people felt that the speed of teaching wasn’t right 2 people were not happy with the library resources

Your Comments Mostly positive: “Well-organised, helpful in the labs” Some of you however felt the need for more labs and exercises and would have liked to learn more about PHP and other languages that MySQL can be used with

Personal Feedback

The Exam

The Exam Structure The exam will contain FIVE questions. You must answer ANY THREE of these Question 1 will be a general question. It will contain a number of smaller questions, that can be about anything on the course The remaining questions will focus on one or two topics. If you answer more than three questions, we will mark the first three only! If you answer more than three questions cross out the ones that you DON’T want us to mark

In the Exam PHP will not be in the exam Any other topic from any lecture might be, including: E/R Diagrams SQL Data Definition SQL SELECT (queries) NULLs Normalization Transactions and Schedules Locking and timestamps Database Security, including Privileges Modern Databases

Past Exam Papers Some papers (not answers unfortunately) are available on the University Portal Unfortunately only those for module G51DBS are currently available. I shall try to rectify this Login to my.nottingham.ac.uk with your IS (not CS) username and password. Go to the “Library” tab, and find the link to “Exam Papers” Search for DBS G51DBS is almost the same as this module. However, you should ignore all questions on relational algebra, because that isn’t part of this module

Exam Techniques Everyone approaches exams differently. Here are some things you might like to consider though: Pay attention to how many marks a question is worth. Don’t write a page for a 4 mark question Have a scan through the exam questions before you start answering them You are answering three questions in 2 hours, which means roughly 40 minutes per question

Exam Techniques Be concise, don’t write more than you have to. For example: Explain the lost update problem with respect to database concurrency. (2 Marks) Example concise answer: The lost update problem occurs when two concurrent transactions update the same resource in a database. The actions of the first transaction are lost when the value is overwritten by the second transaction. Example non-concise answer: The lost update problem is related to database concurrency. Sometimes two transactions may need to read and write from the same resource. They may also need to operate concurrently. When this occurs, the write action of the first transaction might be lost when a second transaction overwrites this value. The lost update problem can be prevented using a locking or timestamping protocol…

SQL Exam Techniques Answering SQL questions are a little different It can be hard to work out where the marks are allocated, so try to avoid worrying about that and instead aim to write a correct query Try to organise your query neatly so the marker can see what you’ve done Don’t forget brackets and semi-colons! There are many ways to answer each SQL SELECT question in particular, so focus on correctness Consider concision. E.g. SELECT DISTINCT artName FROM Artist, CD, Track; Is not a concise answer! (You only need select from Artist)

Marking Scheme The exam has a very specific marking scheme. This means: You will not get any marks for points unrelated to the question You will miss marks if you leave something out, even if the rest of your answer is good. You need to get 50% over the whole module to pass it Remember, you can be pleased with a mark above 60%, and very pleased with a mark above 70%!

Normalization

Transactions and Concurrency Revision

Transaction Transactions are the ‘logical unit of work’ in a database ACID properties Also the unit of recovery It would be helpful to run many transactions at the same time Many users Possibly very long transactions Challenges with running transactions concurrently Lost update Uncommitted update Inconsistent analysis The ACID properties are violated

ACID Atomicity Transactions are Atomic Conceptually they do not have component parts Transactions are either executed fully, or not at all Consistency Transactions take the data base from one consistent state to another Consistency isn’t guaranteed mid-way through a transaction Isolation All transactions execute independently of one another The effects of an incomplete transaction are invisible to other transactions Durability Once a transaction has completed, it is made permanent Must be durable even after a system crash

Schedules A schedule is a sequence of the operations in a set of concurrent transactions that preserves the order of operations in each of the individual transactions A serial schedule is a schedule where the operations of each transaction are executed consecutively without any interleaved operations from other transactions (each must commit before the next can begin)

Example Schedule Three transactions: Example schedule T1 Read(X) Read(Y) Write(X) T2 Read(Y) Read(Z) Write(Y) T3 Read(Z) Write(Z) T1 Read(X) T2 Read(Y) T2 Read(Z) T3 Read(Z) T1 Read(Y) T1 Write(X) T3 Write(Z) T2 Write(Y)

Example Schedule Three transactions: Example serial schedule T1 Read(X) Read(Y) Write(X) T2 Read(Y) Read(Z) Write(Y) T3 Read(Z) Write(Z) T1 Read(X) T1 Read(Y) T1 Write(X) T2 Read(Y) T2 Read(Z) T2 Write(Y) T3 Read(Z) T3 Write(Z)

Serialisability Two schedules are equivalent if they always have the same effect A schedule is serialisable if it is equivalent to some serial schedule For example: If two transactions only read from some data items, the order in which they do this is not important If T1 reads and then updates X, and T2 reads then updates Y, then again this can occur in any order

Conflict Serialisability Two transactions have a confict: NO If they refer to different resources NO If they only read YES If at least one is a write and they use the same resource A schedule is conflict serialisable if the transactions in the schedule have a conflict, but the schedule is still serialisable

Conflict Serialisability Conflict serialisable schedules are the main focus of concurrency control They allow for interleaving and at the same time they are guaranteed to behave as a serial schedule Important questions How do we determine whether or not a schedule is conflict serialisable? How do we construct conflict serialisable schedules

Locking Locking is a procedure used to control concurrent access to data (to ensure serialisability of concurrent transactions) In order to use a ‘resource’ a transaction must first acquire a lock on that resource A resource could be a single item of data, some or all of table, or even a whole database This may deny access to other transactions to prevent incorrect results

Lock Types There are two types of lock Shared lock (often called a read lock) Exclusive lock (often called a write lock) Read locks allow several transactions to read data simultaneously, but none can write to that data Write locks allow a single transaction exclusive access to read and write a resource

Locking Before reading from a resource a transaction must acquire a read-lock Before writing to a resource a transaction must acquire a write-lock A lock might be released during execution when no longer needed, or upon COMMIT or ROLLBACK

Two-Phase Locking A transaction follows two-phase locking protocol (2PL) if all locking operations precede all unlocking operations Other operations can happen at any time throughout the transaction Two phases: Growing phase where locks are acquired Shrinking phase where locks are released

2PL Exercise T1 Read(X) X = X – 5 Write(X) Read(Y) Y = Y + 5 Write(Y) COMMIT T2 Read(X) Read(Y) Sum = X + Y...

Serialisability Theorem Any schedule of two-phase locking transactions is conflict serialisable

Happy Holiday Enjoy the break Revise well Revising