• Keine Ergebnisse gefunden

Relational Databases 2 Exercise Sheet 6: Query Optimization (until Tuesday 05.06.2012)

N/A
N/A
Protected

Academic year: 2021

Aktie "Relational Databases 2 Exercise Sheet 6: Query Optimization (until Tuesday 05.06.2012)"

Copied!
3
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Relational Databases 2

Exercise Sheet 6: Query Optimization (until Tuesday 05.06.2012)

Exercises have to be turned in until Tuesday of each respective week and may be completed in teams of two students each. You may hand in your solutions on paper before the lecture or into the mailbox at the IFIS floor (Mühlenpfordtstraße 23, 2nd floor). Please do not forget your

“Matrikelnummer” on your solutions. Please note: all exercises are optional.

Exercise 1

Assume the relations given in Appendix A.

a. Draw a canonical operator tree for following queries and denote the number of rows of the intermediate result sets of each operation in the tree:

1. SELECT title FROM courses

2. SELECT firstname, lastname FROM students WHERE sex=’f’

3. SELECT s.firstname, s.lastname, r.result, c.title FROM students s, results r, courses WHERE s.matNr=r.matNr AND r.crsNr=c.crsNr AND c.crsNr=100

b. Rewrite query 3 from exercise a) using Algebraic Transformation Rules in such a way that the intermediate results are reduced significantly. Please mark which rule you used and draw the resulting operator tree annotated with the new rows per intermediate result count.

Exercise 2

Assume the relations given in Appendix B. You want to retrieve all actors off all movies of type “cin- ema movie” released after 1980.

a. Create an SQL query for performing that task.

b. Draw the canonical operator tree.

c. Give your best estimation for the size of each intermediate result set in the operator tree in such a way that it is clear how you reached to that result.

d. Discuss the effect of creating a secondary index on title.production_year.

(2)

Appendix A

(3)

Appendix B

Referenzen

ÄHNLICHE DOKUMENTE

Exercises will be discussed on Friday on week after the respective lecture was given. The handouts are optional and do not have to be handed in. They only serve as optional

actor(person → Person, movie → Movie, role) director(person → Person, movie → Movie) hasGenre(movie → Movie, genre → Genre) connection(from → Movie, to → Movie, type)..

Technische Universität Braunschweig Institut für Informationssysteme http://www.ifis.cs.tu-bs.de Karl Neumann, Sarah Tauscher.. Exercises for Spatial Databases and GIS Sheet

Explain the difference between Internal-, Conceptual- and External schemas used in relational database architectures. Explain the difference between Logical- and Physical

Explain the main characteristics of offline, nearline and online storage and give an example.. What type of data should be stored in

You may hand in your solutions on paper before the lecture or into the mailbox at the IFIS floor (Mühlenpfordtstraße 23, 2nd floor).. Please do not

Tree Traversal: Access all nodes of the tree in Pre-Order, In-Order and Post-Order.. Exercise 2:

CREW(movie, person not null , type not null , creditpos) REMARK(movie, person not null , remark not null ) GENRE(movie, genre not null )b. COUNTRY(movie, country not