0% found this document useful (0 votes)
6 views

Lecture 4

This document discusses semantic data control in distributed database systems, including view management, query modification, and materialized views. It covers how views are created and manipulated, how queries on views relate to queries on base relations, and techniques for maintaining materialized views when the base data changes.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Lecture 4

This document discusses semantic data control in distributed database systems, including view management, query modification, and materialized views. It covers how views are created and manipulated, how queries on views relate to queries on base relations, and techniques for maintaining materialized views when the base data changes.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Distributed Database Systems

1
Semantic Data Control

◼ Involves:
❑ View management
❑ Security control
❑ Integrity control

◼ Objective :
❑ Ensure that authorized users perform correct operations on the
database, contributing to the maintenance of the database
integrity.

2
View Management

View – virtual relation EMP


❑ generated from base relation(s) by a query ENO ENAME TITLE
❑ not stored as base relations E1 J. Doe Elect. Eng
E2 M. Smith Syst. Anal.
Example : E3 A. Lee Mech. Eng.
CREATE VIEW SYSAN(ENO,ENAME) E4 J. Miller Programmer
E5 B. Casey Syst. Anal.
AS SELECT ENO,ENAME E6 L. Chu Elect. Eng.
FROM EMP E7 R. Davis Mech. Eng.
E8 J. Jones Syst. Anal.
WHERE TITLE= "Syst. Anal."

3
View Management

Views can be manipulated as base relations

Example :

SELECT ENAME, PNO, RESP


FROM SYSAN, ASG
WHERE SYSAN.ENO = ASG.ENO

4
Query Modification

Queries expressed on views

Queries expressed on base relations


Example :
SELECT ENAME, PNO, RESP
FROM SYSAN, ASG
WHERE SYSAN.ENO = ASG.ENO

SELECT ENAME,PNO,RESP
FROM EMP, ASG
WHERE EMP.ENO = ASG.ENO
AND TITLE = "Syst. Anal."

5
View Management

◼ To restrict access
CREATE VIEW ESAME
AS SELECT * Note that the user J. Doe
FROM EMP E1, EMP E2 also appears in the result.
If the user who creates
WHERE E1.TITLE = E2.TITLE ESAME is an electrical
AND E1.ENO = USER(); engineer, as
◼ Query
SELECT *
FROM ESAME

6
View Updates

◼ Updatable
CREATE VIEW SYSAN(ENO,ENAME)
AS SELECT ENO,ENAME
FROM EMP
WHERE TITLE="Syst. Anal."

◼ Non-updatable
CREATE VIEW EG(ENAME,RESP)
AS SELECT ENAME,RESP
FROM EMP, ASG
WHERE EMP.ENO=ASG.ENO

7
View Management in Distributed DBMS

◼ Views might be derived from fragments.


◼ View definition storage should be treated as database
storage
◼ Query modification results in a distributed query
◼ View evaluations might be costly if base relations are
distributed
❑ Use materialized views

8
Materialized View

◼ Origin: snapshot in the 1980’s


❑ Static copy of the view, avoid view derivation for each query
❑ But periodic recomputing of the view may be expensive
◼ Actual version of a view
❑ Stored as a database relation, possibly with indices
◼ Used much in practice
❑ DDBMS: No need to access remote, base relations
❑ Data warehouse: to speed up OLAP
◼ Use aggregate (SUM, COUNT, etc.) and GROUP BY

9
Materialized View Maintenance

◼ Process of updating (refreshing) the view to reflect


changes to base data
❑ Resembles data replication but there are differences
◼ View expressions typically more complex
◼ Replication configurations more general
◼ View maintenance policy to specify:
❑ When to refresh
❑ How to refresh

10

You might also like