# Suppose that a relation factory contains 800 tuples and Each tuple is comprised of a header: Database Systems Coursework, UOS, UK

 University University Of Salford (UOS) Subject Database Systems

Assessment set by Dr. Bryant

• Dr. Bryant’s surgeries take during the teaching part of the semester. The time of his next surgery is shown on Blackboard’s calendar. Please note that this is a drop-in service. In other words, there is no need to make an appointment. Please simply give him a call via MS Teams during his surgery hours. Please remember to have your microphone switched on if you want him to hear you and to have your camera switched on if you want him to see you.
• If you are new to MS Teams then please note that you can find an introduction to MS Teams at https://www.linkedin.com/learning/microsoft-teams
• If you just want to send him an email, then do not use MS Teams or Blackboard to do this. Instead, please send it to his usual email address

Questions

1) (a) Suppose that a relation factory contains 800 tuples. Each tuple is comprised of a header (24 bytes) and four attributes: ID (5 bytes), name (10 bytes), street (20 bytes), and postcode (6 bytes). The size of each disc block is 1024 bytes and the size of the header of each disc block size 24 bytes.

(i) How many blocks would be required to store the whole of this relation?

(ii) How many blocks would be required to store a projection that does not include the attribute street?

(iii) Explain why such a projection could be used to optimize a query whose
results do not include data for the attribute street.

(b) Consider the SQL query shown in Table 1.
(i) Draw a near-optimal query tree for the SQL query.

(ii) Identify the root and leaf nodes in the tree that you drew for part (i).

(iii) Write down a justification for the position of the root node and each of the internal nodes in the tree that you drew for part (i) in terms of the heuristic steps that optimizers apply to reduce the cost of optimization. Explain why the position of the nodes should make the query efficient.