COMP3311 Final Exam 21T3 The University of New South Wales
COMP3311 Database Systems
Final Exam 21T3
Database Systems
[Front Page] [Notes] [Database] [Course Website] [Cheat Sheets]
[Q1] [Q2] [Q3] [Q4] [Q5] [Q6] [Q7] [Q8] [Q9] [Q10]

Question 8 (4 marks)

Explain each of the following observations in 2-4 sentences.

  1. Consider the execution times of the following queries:

    mymyunsw=# select fullname from people where id=9300035;
       fullname    
    ---------------
     John Shepherd
    (1 row)
    
    Time: 1.242 ms
    mymyunsw=# select fullname from people where id=9300035;
       fullname    
    ---------------
     John Shepherd
    (1 row)
    
    Time: 0.284 ms
    

    Subsequent execution times for the same query are all around 0.28 ms. Why is the first execution so much slower? Assume that the database server started just before the first query.

  2. Consider the execution times of the following two queries:

    mymyunsw=# select max(id) from people;
       max   
    ---------
     5235067
    (1 row)
    
    Time: 0.291 ms
    
       
    mymyunsw=# select max(birthday) from people;
        max     
    ------------
     2000-12-30
    (1 row)
    
    Time: 0.891 ms
    

    Subsequent executions of the queries have similar timing. Why is the first query faster than the second?

Instructions:

End of Question