CM603.21 Name : p.rajesh Year/Semester : VI Semester Subject : Advanced database system Subject Code...

Post on 19-Jan-2016

217 views 2 download

Tags:

Transcript of CM603.21 Name : p.rajesh Year/Semester : VI Semester Subject : Advanced database system Subject Code...

CM603.2 1

Name : p.rajesh

Year/Semester : VI Semester

Subject : Advanced database system

Subject Code : CM-603

Topic : Advanced database concepts

Duration : 50 minutes

Sub Topic : Transactions Properties

Teaching Aids : Animation clips

CM603.2 2

Recap

In this previous class, you have learnt about

• Basics of Transactions

CM603.2 3

OBJECTIVES:

On completion of this period, you would be able to know

•Transactions Properties

CM603.2 4

Transactions and Concurrent Execution

• Transaction - DBMS’s abstract view of a user program (or activity): • A sequence of reads and writes of database objects.• Unit of work that must commit or abort as an atomic

unit• Transaction Manager controls the execution of

transactions.• User’s program logic is invisible to DBMS

• Arbitrary computation possible on data fetched from the DB

• The DBMS only sees data read/written from/to the DB.

CM603.2 5

Definitions

• Data Items—collection of objects representing a database.

• Granularity—size of a data item.• Concurrency—multiple users accessing a

database instance at the same time.• Transaction—a logical unit of database

processing that includes one or more database access operations from the following• Insert, Delete, Modify, Retrieve operations

• Serializability—Interleaving execution of a set of concurrent transactions without “giving up any correctness”.

CM603.2 6

Definitions

• Concurrency Control Protocols—set of rules for defining the execution of concurrent transactions (ultimately to ensure serializability)• Optimistic Concurrency Control—validation or

certification of a transaction AFTER it executes• If interference is detected, the transaction is

aborted and restarted at a later time

Contd…

CM603.2 7

Transaction Properties

All transactions must display Atomicity, Consistency, Isolation, Durability and Serializability.

• These properties are referred to as ACIDS test

CM603.2 8

Atomicity

• Atomicity requires that all operations of a transaction must be completed. If not the transaction is aborted.

• If a transaction T1 has four SQL requests, all four requests must be successfully completed. Otherwise the entire transaction is aborted. – In other words, a transaction is treated as a

single, indivisible, logical unit of work.

CM603.2 9

Consistency

• A transaction must transform the database from one consistent state to another consistent state.

• It is the responsibility of both the DBMS and the application programmers to ensure consistency.

• Consistency indicates the permanence of the database’s consistent state.

• When a transaction is completed the database reaches a consistent state.

CM603.2 10

Isolation:• Transactions execute independently of one another. • The partial effects of a transaction should not be

visible to other transactions.• Isolation means that the data used during the

execution of a transaction cannot be used by a record transaction until the first one is completed.

• This property is useful in multi-user database environment because several different users can access and update the database at the same time

CM603.2 11

Durability

• Once a transaction is completed successfully, its results are recorded permanently in the database .

• They should not be lost because of any subsequent failures

CM603.2 12

Serializability

• A schedule is a list of operations by a set of concurrent transactions.

• A schedule is called serial when the operations of each transaction are executed consecutively without any interleaving.

• If there is any interleaving among the transaction then the schedule is non-serial.

CM603.2 13

• When transactions are executed concurrently in

a non-serial schedule is producing the same results as a serial schedule then the schedule is called serializable.

• A serial schedule never leaves the database in inconsistent state.

• Serializability is to find non-serial schedules, which can allow transactions to run concurrently with no interference and can produce correct results

Serializability

Contd…

CM603.2 14

Summary

We have discussed about

Transactions Properties- ACIDS

CM603.2 15

1. Transaction properties are also known as---

(a) DBMS

(b) RDBMS

(c) ACIDS

(d) AIDS

QUIZ

CM603.2 16

1. Transaction properties are also known as---

(a) DBMS

(b) RDBMS

(c) ACIDS

(d) AIDS

QUIZ

CM603.2 17

2. The property that transaction completed successfully is --

(a) serial

(b) isolated

(c) durability

(d) atomicity

QUIZ

CM603.2 18

(a) serial

(b) isolated

(c) durability

(d) atomicity

QUIZ

2. The property that transaction completed successfully is --

CM603.2 19

3. Serial schedule is ------

(a) physical

(b) stream

(c) multi

(d) serializable

QUIZ

CM603.2 20

3. Serial schedule is ------

(a) physical

(b) stream

(c) multi

(d) serializable

QUIZ

CM603.2 21

Questions

1. Explain Transaction properties?