ddb - integrity enfrcement

Post on 14-Aug-2015

160 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

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

Course incharge : SIR BILAL QURESHI

Distributed Database systems

INTEGRITY ENFORCEMENT

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.

METHODS

Two basic methods permit the rejection of inconsistent update transactions.

Detection Prevention

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.

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)

EFFICIENCY

The preventive approach is more efficient

than the detection approach since updates never need to be undone

because of integrity violation.

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.

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.

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

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

top related