ddb - integrity enfrcement

13

Upload: rashiqa-qureshi

Post on 14-Aug-2015

160 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: DDB - integrity Enfrcement
Page 2: DDB - integrity Enfrcement

RASHIQA MAHMOOD 12-ARID-2152ANAM ZAHEER 12-ARID-2087NAFEESA SHAHID 12-AIRD-2142

Course incharge : SIR BILAL QURESHI

Page 3: DDB - integrity Enfrcement

Distributed Database systems

INTEGRITY ENFORCEMENT

Page 4: DDB - integrity Enfrcement

INTEGRITY ENFORCEMENT

Semantic integrity consists of rejecting updatetransactions that violate some integrity

constraints.Integrity constraints represent knowledge about

data with which a database must be consistent, which means that the data contained in a database is both accurate and valid.

A constraint is violated when it becomes false in the new database state produced by the update transaction.

Page 5: DDB - integrity Enfrcement

METHODS

Two basic methods permit the rejection of inconsistent update transactions.

Detection Prevention

Page 6: DDB - integrity Enfrcement

1. DETECTION

The first one is based on the detection of inconsistencies.

Execute update u: D Du

If Du is inconsistent then

if possible: compensate Du Du’

elseundo Du D

This approach may be inefficient if a large amount of work (the update of D) must be undone in the case of an integrity failure.

Page 7: DDB - integrity Enfrcement

2. PREVENTION

The second method is based on the prevention of inconsistencies. An update is executed only if it changes the database state to a consistent state.Execute u: D Du only if Du will be consistent

The tuples subject to the update transaction are either

directly available (in the case of insert) or must be retrieved from the database (in the

case of deletion or modification)

Page 8: DDB - integrity Enfrcement

EFFICIENCY

The preventive approach is more efficient

than the detection approach since updates never need to be undone

because of integrity violation.

Page 9: DDB - integrity Enfrcement

POSTTEST & PRETEST

POSTTEST Tests are derived

by integrity constraints. these tests are applied

after having changed the

database state, they are generally called posttests.

PRETESTTests, derived by

integrity constraints, are applied before the database

state is changed they are generally

called pretests.

Page 10: DDB - integrity Enfrcement

QUERY MODIFICATION ALGO

The query modification algorithm is an example of a preventive method that is particularly efficient at enforcing domain constraints.

It adds the assertion qualification to the

query qualification by an AND operator so that the modified query can enforce integrity.

Page 11: DDB - integrity Enfrcement

EXAMPLE

UPDATE PROJ

SET BUDGET = BUDGET*1.1

WHERE PNAME = "CAD/CAM"

UPDATE PROJ

SET BUDGET = BUDGET*1.1

WHERE PNAME = "CAD/CAM"

AND NEW.BUDGET ≥ 500000

AND NEW.BUDGET ≤ 1000000

Page 12: DDB - integrity Enfrcement

QUERY MODIFICATION ALGO

It produces pretests at run time by ANDing the assertion predicates with the update predicates of each instruction of the transaction.

This algorithm only applies to tuple calculus formulae

Page 13: DDB - integrity Enfrcement