You are on page 1of 7

Week 1: How DBMSs work internally

- overall architecture

- algorithms and data structure for RA ops

- analyse costs (disk reads/writes)

https://www.cse.unsw.edu.au/~cs9315/22T1/notes/A/notes.html

Relational Algebra

- The last one is different due to the efficiency. Better to have run through the smaller one first.

Week 2:
Calculate the number of reads on input and the number of reads on output.

Calculate the time for a read.


Buffer pool (sort of like a memory cache):

Get_page();

Rather than reading from disk all the time ,the buffer pool can possibly save time and let us read
from here. (sort of like a cache).

LRU – Least recent used

MRU – Most recent used


3 buffers- Everytime you read a page of C, you got to read a page of E. You read C 10 times, and you
read E 40 times.

20 buffers – you only need 14 of the 20 buffers to hold all of the data.

MRU

In the last line, C3 is not replaced because it is still being used.

Buffers would normally show when it was last used.

We can try this out in ex4 of Week 2. You need to “Make” the makefile first if not already.
./jsim to see usage

Run it to see the joint simulation. Can even check the joinsim.c

We want hits. Hits is good.

Clock-sweep: a circular buffer pool list. Based on ‘pinned’ popularity.

Week 2, exercise 6

W2, Exercise 7

Integer 4 bytes, char 10 bytes (effectively char 12 , due to padding. so, just 10. Fixed size)

float 8 bytes,

4 bytes to tell how long varchar is + length of Varchar (anywhere between 0 and 10).

So without variable d, it is 4 + 12 + 8 = 24.

With d, it is 4 + 12 + 8 + 4 + (0:10) = 28:38

W2, Exercise 8

Looking at how data is saved and stored in pages.


W3

W3a

e.g. (0,4,int)

offset is 0, goes on for 4 length, and stores integer.

(6,10, char) <- should be a var char.

Offset is 6, goes for 10, and stores char.

Note: the offset is 6 and not 4 because it stores the length (+ padding) of the varchar in the 2 fields.

To answer the Q:

Check the exercises

General cost: Time to answer a query is dominated by the time taken to read pages

Week 4a:
Data file structures:

Heap files are files ordered randomly

Sorted files are files sorted in order

Hash File are those with indexes in order.

You might also like