0% found this document useful (0 votes)
83 views2 pages

Quiz10 Solution PDF

The document is a quiz on physical database design and NoSQL. It contains 5 multiple choice questions about designing indexes for relational tables to optimize for different query workloads, identifying good candidates for clustered indexes, and comparing a relational design to alternative NoSQL designs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views2 pages

Quiz10 Solution PDF

The document is a quiz on physical database design and NoSQL. It contains 5 multiple choice questions about designing indexes for relational tables to optimize for different query workloads, identifying good candidates for clustered indexes, and comparing a relational design to alternative NoSQL designs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Quiz 10: Physical DB Design and NoSQL _______________________________

Initial Score (out of 10)

Taken by: _______________________________________________ _______________________________


Name Student ID
● We will discuss the answers right after the quiz.
● You are to self-grade and record your actual ​initial​ score (above) as we do so.
● You should also record the correct answers for any problems that you miss.
● A full 10 points for taking this quiz will be included as part of your quiz grade.

1. ​(5 points)​ Consider the following schema for an e-commerce application:


Diver​(​did​, firstname, lastname,age, expertise_level)
Purchases​(​did​, ​eid​, date​)
Equipment​(​eid​, name,price)

Come up with a good physical database design to support a workload that consists of the following
expected mix of queries:

Q0​: ​SELECT​ * ​FROM​ Equipment ​WHERE​ eid = ​value1​;


Q1​: ​SELECT​ * ​FROM​ Diver ​WHERE​ firstname ​LIKE​ ‘%​value1​%’;
Q2​: ​SELECT​ price, ​COUNT​(*) ​FROM​ Equipment ​GROUP BY​ price;
Q3​: ​SELECT​ E.name, E.price ​FROM​ Equipment E, Purchases P, Diver D
WHERE​ D.age = ​value1​ ​AND​ E.eid = P.eid ​AND​ D.did = P.did;
Q4​: ​SELECT​ * ​FROM​ Equipment ​WHERE​ name ​LIKE​ ‘​value1​%’

Suppose this data will be residing in a DBMS that only offers B+ Trees as its choice of index type. Come up
with a good set of indexes for the data and the workload above – indicating, for each recommended index,
the indexed columns and the motivating queries in the table below. Use the first column of the table to
number the indexes from 1 to N for quick reference in subsequent parts of this problem. (Not all rows
need to be filled in.)

Index Number Indexed Table Indexed Column(s) Motivating Query(s)


1 Equipment eid Q0​,Q3
2 Equipment price Q2
3 Purchases (did,eid) or did Q3
4 Diver age or (age,did) Q3
5 Equipment name Q4
(2) ​(3 points)​ Your design above should have at least one entry for each of the database’s tables. Indicate
below (by index number) what are your index option(s) to be considered for a clustered index, if any, and
briefly say why.

(i) Clustered index(es) for Diver: ​age(clustered) -(age,did) Unclustered

(ii) Clustered index(es) for Purchases: ​did (clustered) -(did,eid) Unclustered

(iii) Clustered index(es) for Equipment: ​5


( 2 is index only)(1 :in Q0 it is primary key lookup,at max one match).

3. ​(2 points) ​In NOSQL world, instead of having three relations, we could insert a bag of (eid,date) pairs in
Diver or a bag of (did,date) in Equipment table. Briefly mention why keeping the relations as it is
(relational case) would be better for this example than any of the mentioned NOSQL alternatives .

Disadvantage: Objects will get large by each purchase in an ever-growing fashion. Also, it needs indexing
on nested data in order to go in the other direction.

You might also like