Data Storage Flashcards

1
Q

Describe features of primary storage

A
<ul>
<li>Fast</li>
<li>Expensive</li>
<li>Volatile</li>
</ul>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does primary storage hold?

A

Data that needs to be operated on

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe features of secondary storage

A
<ul>
<li>Moderately fast</li>
<li>Cheaper</li>
<li>Non-volatile</li>
</ul>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does secondary storage hold?

A

Data that is not currently being operated on

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe features of tertiary storage

A
<ul>
<li>Slow</li>
<li>Cheap</li>
<li>Non-volatile</li>
<li>Durable</li>
</ul>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does tertiary storage hold?

A

Archival data, long term back ups

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a block?

A

Unit of storage allocation and of data transfer between secondary and primary storage
Continguous sequence of sectors from a single track

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a typical block size today?

A

Between 4 and 8 kilobytes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the formula for a cost of a block access?

A

access time + (block size/data transfer rate)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the assumptions for a fixed length record?

A

<ul>
<li>Record size is fixed</li>
<li>Each file has records of one particular type only</li>
<li>Different files are used for different relations</li>
<li>Each record is entirely contained in a single block</li>
<li>No record is larger than a block</li>
</ul>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Describe the simple approach to storing fixed length records

A

Attributes are stored in order, store record i starting from byte n x i where n is the size of each record

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the problems with the simple approach for storing fixed length records?

A

<ul>
<li>Need maximum allocation per field, wasteful</li>
<li>Block size unlikely to be multiple of record size</li>
</ul>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the three ways deletion can be dealt with in fixed length record storage?

A

<ol>
<li>Compact records by shifting them left</li>
<li>Move record n into the gap</li>
<li>Fill the gap on the next insertion</li>
</ol>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are free lists?

A

A way to arrange the data structure to hold where the deleted records are

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How do free lists work?

A

Store the address of the first deleted record in the file header, then the first deleted record stores the address of the second deleted record and so on

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How does insertion work with a free list data structure?

A

Use the pointer from the header, then change the header to point to the next one

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Describe a variable length record

A

The length of the record varies depending on how much data must be stored

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What can variable length records be used to store?

A

<ul>
<li>Multiple record types in a file</li>
<li>Record types that allow for variable lengths</li>
<li>Record types that allow for repeating fields</li>
</ul>

19
Q

What is the main problem to think about when looking at storage of variable length records?

A

How do we make sure we can quickly look at the right part of the file to find the information that we want

20
Q

How is a single variable length record storage?

A

Attributes are stored in order, variable length attribute allocated enough bytes to store an offset and a length. Actual data is stored after all fixed length attributes at specificed attributes

21
Q

What does the slotted page header contain when storing variable length records?

A
<ul>
<li>Number of record entries</li>
<li>End of free space in the block</li>
<li>Location and size of each record</li>
</ul>
22
Q

What happens when a new record is added to a block storing variable length records?

A

<ol>
<li>Insert the record at the end of free space</li>
<li>Update the header, add one to list of entries, take away from end of free space and insert location and size into block header</li>
</ol>

23
Q

What are the three main ways you can organise storing records?

A
<ol>
<li>Sequential</li>
<li>Heap</li>
<li>Hashing</li>
</ol>
24
Q

Describe sequential record organisation

A

Store records in sequential order, based on the value of the search key of each record

25
Q

Describe heap record organisation

A

A record can be placed anywhere in the file where there is space

26
Q

Describe hashing record organisation

A

A hash function is computed on some attribute of each record and the result is used to tell where file is placed

27
Q

What kind of files would require sequential record organisation?

A

Applications that require sequential processing of the entire file

28
Q

How does insertion work in sequential file organisation?

A

Locate the position where the record is to be inserted, if there is free space, insert there. if no free space, insert the record in an overflow block

29
Q

Why do we need to sometimes reorganise sequential files?

A

To minimise hops around blocks and to restore sequential order, with respect to the overflow block

30
Q

What is the vision of heap files?

A

Just insert record wherever there is space according to the free list

31
Q

Describe the compromised version of heap files

A

<ol><li>Insert records in the correct block (according to search key order)</li><li>Within that block, insert the record wherever there is space according to the header's free list</li><li>Within block, chain inserted records together to indicate search key order </li></ol>

32
Q

Describe multi-table clustering and where it might be useful

A

Store several relations in one file with pointer chains to link records of a particular relation

Good for queries involving both relations, but bad for single relation queries

33
Q

What are some examples of metadata that the data dictionary stores

A

<ul>
<li>Information about relations (schema)</li>
<li>User data</li>
<li>Statistical and descriptive data for each block/relation</li>
<li>Physical file organisation information</li>
<li>Information about indices</li>
</ul>

34
Q

What is another name for the data dictionary

A

System catalog

35
Q

What is the buffer?

A

A portion of main memory availabile to store copies of disk blocks

36
Q

What is the buffer manager?

A

Subsystem responsible for allocating buffer space in main memory

37
Q

What happens when a program calls on the buffer manager for a certain block and it isn’t in the buffer?

A

<ol>
<li>Allocates space in the buffer for the block</li>
<li>Reads the block from the disk to the buffer</li>
<li>Returns the address of the block in main memory to requester</li>
</ol>

38
Q

How do most operating systems choose with block to place back into memory if the buffer is full?

A

Least Recently Used (LRU) strategy

39
Q

What is the main idea behind LRU stategy?

A

Use past pattern of block references as a predictor of future refereces

40
Q

When can LRU be a bad strategy?

A

When database is accessing repeated scans of data (i.e. when computing the join of two relations)

41
Q

State some alternative buffer replacement strategies?

A

<ul>
<li>Toss immediate strategy</li>
<li>Most recently used strategy</li>
</ul>

42
Q

Describe the toss immediate strategy

A

Frees the space occupied by a block as soon as the final tuple of that block has been processed

43
Q

Describe the most recently used strategy

A

After the final block of the just processed tuple is finished, block is unpinned and it is discarded

44
Q

What is the length of a null bitmap?

A

1 byte