Ch2 Ch3 Mina
Ch2 Ch3 Mina
Ch2 Ch3 Mina
2, let p1: TITLE < "Programmer" and p2: TITLE > “Programmer” be two
simple predicates. Assume that character strings have an order among them, based on the alphabetical order.
(a) Perform a horizontal fragmentation of relation EMP with respect to {p1, p2}.
(b) Explain why the resulting fragmentation (EMP1, EMP2) does not fulfill the correctness rules of fragmentation.
(c) Modify the predicates p1 and p2 so that they partition EMP obeying the correctness rules of fragmentation. To do
this, modify the predicates, compose all minterm predicates and deduce the corresponding implications, and then
perform a horizontal fragmentation of EMP based on these minterm predicates. Finally, show that the result has
completeness, reconstruction, and disjointness properties
Fig.2.2
Solution:
a)
b) The resulting fragmentation is incomplete since E4, who is a Programmer cannot be found in either fragment.
c) This can be accomplished by changing p1 as TITLE ≤ “Programmer” or changing p2 as TITLE ≥ “Programmer”.
If p1 is changed, E4 will be added to EMP1; if p2 is modified, E4 will be added to EMP2.
*****************************************************************************
Problem 2.2 (*) Consider relation ASG in Fig. 2.2. Suppose there are two applications that access ASG. The first is issued
at five sites and attempts to find the duration of assignment of employees given their numbers. Assume that managers,
consultants, engineers, and programmers are located at four different sites. The second application is issued at two sites
where the employees with an assignment duration of less than 20 months are managed at one site, whereas those with
longer duration are managed at a second site. Derive the primary horizontal fragmentation of ASG using the foregoing
information.
Solution:
• Note that m4, m5, and m8 are empty, so in the end we get the following fragments:
Problem 2.3(*) Consider relations EMP and PAY in Fig. 2.2. EMP and PAY are horizontally fragmented as follows:
EMP4 = σTITLE=“Programmer”(EMP)
PAY1 = σSAL≥30000(PAY)
PAY2 = σSAL<30000(PAY)
Draw the join graph of EMPTITLE PAY. Is the graph simple or partitioned? If it is partitioned, modify the fragmentation of
either EMP or PAY so that the join graph of EMP TITLE PAY is simple.
Solution:
Solution:
• Completeness: all tuples in the original relation EMP can be found in the resulting relations EMP1, EMP2.
• Reconstruction: The original relation EMP can be reconstructed by the union operator on the resulting
fragments: EMP1 and EMP2.
• Disjointness: EMP1 and EMP2 do not have any common tuples.
Problem 2.7 (**) Write an algorithm for derived horizontal fragmentation
Solution:
Problem 2.15 (**) Describe how the following can be properly modeled in the database allocation problem.
Solution:
a)The relationships among fragments can be properly modeled in the database allocation problem by
using a graph data structure. The fragments can be represented as nodes in the graph, and the
relationships among the fragments can be represented as edges in the graph.
b)Query processing can be modeled in the database allocation problem by using a query processing
algorithm. The query processing algorithm can be used to find the fragments that are relevant to the
query, and to generate the results of the query.
c)Integrity enforcement can be modeled in the database allocation problem by using an integrity
enforcement algorithm. The integrity enforcement algorithm can be used to enforce the integrity
constraints of the database.
d)Concurrency control can be modeled in the database allocation problem by using a concurrency control
algorithm. The concurrency control algorithm can be used to control the access of the fragments to the
database.
*****************************************************************************************
Problem 2.16 (**) Consider the various heuristic algorithms for the database allocation problem.
(a) What are some of the reasonable criteria for comparing these heuristics? Discuss.
Solution:
(b) A step-by-step technique for addressing a specific problem in a finite number of steps is known as an
algorithm. Given the same parameters, an algorithm's outcome is predictable and repeatable. A heuristic
is an educated guess that serves as a starting point for further investigation. Heuristic evaluation involves
someone looking at the user interface and identifying issues. Potential consumers check out the user
interface with real tasks during usability testing. The issues discovered during usability testing are genuine
issues, as each one was experienced by at least one user. The fundamental difference is that a
representative heuristic makes judgments on items and people based on stereotypes. The availability
heuristic, on the other hand, uses recent events to help predict future events.
**************************************************************************************************
**************************************************************************************************
Problem 3.1. Define in SQL-like syntax a view of the engineering database V(ENO,ENAME, PNO, RESP), where the
duration is 24. Is view V updatable? Assume that relations EMP and ASG are horizontally fragmented based on access
frequencies as follows:
EMP1 EMP2
ASG1 ASG2
where
EMP1 = σTITLE6=“Engineer”(EMP)
ASG1 = σ0<DUR<36(ASG)
ASG2 = σDUR≥36(ASG)
At which site(s) should the definition of V be stored without being fully replicated to increase locality of reference?
Solution:
In new folder
***********************************************************************************************
Problem 3.2 Express the following query: names of employees in view V who work on the CAD/CAM project.
Solution:
In new folder
***********************************************************************************************
Modify the query obtained in Problem 3.2 to a query expressed on the fragments.
Solution:
In new folder
***********************************************************************************************
Problem 3.4 (**) Propose a distributed algorithm to efficiently refresh a snapshot at one site derived by projection from
a relation horizontally fragmented at two other sites. Give an example query on the view and base relations which
produces an inconsistent result.
Solution:
************************************************************************************************
Problem 3.6 Propose a relation schema for storing the access rights associated with user groups in a distributed
database catalog, and give a fragmentation scheme for that relation, assuming that all members of a group are at the
same site.
Solution:
FRAGMENTATION :
In this model tables are divided by two parts or pieces, referred to as partitions or fragments that could be
stored at various locations. This is because it is rare that all data in a table will be required at the same
location. Additionally, fragmentation enhances parallelism and helps with disaster recovery. In this case,
there is just one replica of each fragment in this system i.e. no redundant data.
The three techniques for fragmentation are:
Vertical fragmentation
Horizontal fragmentation
Hybrid fragmentation
Vertical Fragmentation
In vertical fragmentation the columns or fields in a table get divided into fragments. In order to ensure the
integrity of the reconstruction each fragment must contain one primary field(s) within the table. Vertical
fragmentation can be utilized to protect data from unauthorized access.
Let us say that the University database records the students who have registered in the Student table with
this schema.
STUDENT
Regd_No Name Course Address Semester Fee Marks
Step 4
The fees information are kept in the section of accounts. In this instance the designer would break the
database in the following manner:
CREATE TABLE STD_FEES AS
SELECT Regd_No, Fees
FROM STUDENT;
Horizontal Fragmentation
Horizontal fragmentation is the process of dividing the tuples of tables according to the numbers of fields
or values. Horizontal fragmentation also needs to adhere to the principle of reconstructiveness. Each
horizontal fragment should have all columns from the original base table.
For instance in the student schema in the student schema, if the data of all students in the Computer
Science Course needs to be kept at the School of Computer Science, then the designer will vertically split
the database according to the following pattern:
CREATE COMP_STD AS
SELECT * FROM STUDENT
WHERE COURSE = "Computer Science";
Hybrid Fragmentation
When a hybrid method is employed, it's a mix of vertical and horizontal fragmentation techniques is used.
It is the most adaptable method of fragmentation as it creates fragments with only the minimum of extra
information. However, re-creating the original table can be costly.
Hybrid fragmentation is possible in two ways:
First, create the horizontal fragments. Later, create vertical fragments using one or more horizontal
fragments.
In the beginning, you will need to generate the vertical fragments. Later, you can create horizontal
fragments using one or more vertical fragments.
**********************************************************************************************
Problem 3.7 (**) Give an algorithm for executing the REVOKE statement in a distributed DBMS, assuming that the
GRANT privilege can be granted only to a group of users where all its members are at the same site.
Solution:
The main difficulty with this approach is that the revoking process must be
recursive. For example, if A, who granted B who granted C the GRANT privilege on object O, wants to
revoke all the privileges of B on O, all the privileges of C on O must also be revoke.
Bell and Lapaduda model
1. A subject S is allowed to read an object of security level l only if level(S) ≥ l called the (No READ
UP).
2. A subject S is allowed to write an object of security level l only if class(S) ≤ l , (no Write Down)
Steps: