You are on page 1of 4

Worksheet 1. 2. 3. 4. Discuss the relative advantages of centralized and distributed databases. Explain fragmentation transparency.

What are advantages and disadvantages of replication or fragmentation of data? Consider the relations

employee (name, address, salary, plant number) machine (machine number, type, plant number) Assume that the employee relation is fragmented horizontally by plant number, and that each fragment is stored locally at its corresponding plant site. Assume that the machine relation is stored in its entirety at the xxxxx site. Describe alternative strategies for processing each of the following queries. Find all employees at the plant that contains machine number 1130. Find all employees at plants that contain machines whose type is milling machine. Find all machines at the xxxx plant. Find employee machine.

Describe how your choice of a strategy depends on the site at which the query was entered. 5. Consider a database that records data about movies, television shows, actors, and reviews of those featured in visual entertainment media. Our database consists of following relations: Movies(movie id, title, release year, star rating, era id) Movie Eras(era id, description, beginning year) Movie Cast(person id, movie id, real name, name in movie) Movie Reviews(movie id, reviewer id, review text, review star rating, date) Reviewers(reviewer id, name, email) Some sample data from the listed relations are as follows:

Movitable

Movie cast

Movie Era

a. Assume the following client applications that access this database: Determine the movie title and release year based on the star rating Given a movie id, find the real and character name of all the cast. Determine all movie titles with their star ratings based on the given release year. Perform horizontal fragmentation (primary and derived) on Movies and Movie Cast relations. Check the correctness of the fragment.

6. Consider that the relation Reviewers is horizontally fragmented as follows: Reviewers1 = reviewer id_200000 (Reviewers) Reviewers2 = reviewer id>200000 (Reviewers) Transform the following query into a reduced query of fragments. (data localization) SELECT r.name FROM Reviewers r, Movie_Reviews mr WHERE r.reviewer_id = mr.reviewer_id AND r.reviewer_id = '2011' 7. Assume that relation Reviewers is fragmented as above. Now, consider a derived horizontal fragmentation of relation Movie Reviews:

Furthermore, the relation Movies is vertically fragmented as:

Transform the following query into a reduced query on fragments. SELECT m.title FROM Movies m, Reviewers r, Movie_Reviews mr WHERE m.movie_id = mr.movie_id AND r.reviewer_id = mr.reviewer_id AND r.name = 'Cagri' 8. Consider a join among tables Reviews, Movie Reviews and Movies from the previous example. Figure 1 shows both the join graph and the distribution onto three sites.

a. Given the following information: size(Movies)=100, size(Movie Reviews)=200, size(Reviewers)=300, size(Movies Z Movie Reviews)=300, size(Movie Reviews Z Reviewers) = 200, describe several alternatives for building a join ordering program. b. What is the optimal ordering that minimizes query response time (consider communication only)? c. Consider using semi-joins instead of joins. Compare the two approaches and give reasons (pro and against) for using one over the other.

You might also like