• Home
  • Textbooks
  • Fundamentals of Database Systems
  • Disk Storage, Basic File Structures, and Hashing

Fundamentals of Database Systems

Ramez Elmasri, Shamkant B. Navathe

Chapter 13

Disk Storage, Basic File Structures, and Hashing - all with Video Answers

Educators


Chapter Questions

01:44

Problem 1

What is the difference between primary and secondary storage?

Kendrick Buford
Kendrick Buford
Numerade Educator
01:33

Problem 2

Why are disks, not tapes, used to store online database files?

Aaron Goree
Aaron Goree
Numerade Educator
03:26

Problem 3

Define the following terms: disk, disk pack, track, block, cylinder, sector, interblock gap, read/write head.

Nathan Silvano
Nathan Silvano
Numerade Educator
01:35

Problem 4

Discuss the process of disk initialization.

Adam Conner
Adam Conner
Numerade Educator
03:45

Problem 5

Discuss the mechanism used to read data from or write data to the disk.

Foster Wisusik
Foster Wisusik
Numerade Educator
02:26

Problem 6

What are the components of a disk block address?

Adam Conner
Adam Conner
Numerade Educator
01:33

Problem 7

Why is accessing a disk block expensive? Discuss the time components involved in accessing a disk block.

Aaron Goree
Aaron Goree
Numerade Educator
02:22

Problem 8

Describe the mismatch between processor and disk technologies.

Shelby Mohamed
Shelby Mohamed
Numerade Educator
04:58

Problem 9

What are the main goals of the RAID technology? How does it achieve them?

Prabhakar Kumar
Prabhakar Kumar
Numerade Educator
01:51

Problem 10

How does disk mirroring help improve reliability? Give a quantitative example.

Shiksha Dutta
Shiksha Dutta
Numerade Educator
View

Problem 11

What are the techniques used to improve performance of disks in RAID?

Susan Hallstrom
Susan Hallstrom
Numerade Educator
00:51

Problem 12

What characterizes the levels in RAID organization?

Ayushi Sambyal
Ayushi Sambyal
Numerade Educator
02:07

Problem 13

How does double buffering improve block access time?

Narayan Hari
Narayan Hari
Numerade Educator
00:59

Problem 14

What are the reasons for having variable-length records? What types of separator characters are needed for each?

Pratyush Raitan
Pratyush Raitan
Numerade Educator
01:14

Problem 15

Discuss the techniques for allocating file blocks on disk.

Sanchit Jain
Sanchit Jain
Numerade Educator
03:45

Problem 16

What is the difference between a file organization and an access method?

Foster Wisusik
Foster Wisusik
Numerade Educator
00:34

Problem 17

What is the difference between static and dynamic files?

David Collins
David Collins
Numerade Educator
View

Problem 18

What are the typical record-at-a-time operations for accessing a file? Which of these depend on the current record of a file?

James Kiss
James Kiss
Numerade Educator
01:14

Problem 19

Discuss the techniques for record deletion.

Sanchit Jain
Sanchit Jain
Numerade Educator
02:49

Problem 20

Discuss the advantages and disadvantages of using (a) an unordered file, (b) an ordered file, and (c) a static hash file with buckets and chaining. Which operations can be performed efficiently on each of these organizations, and which operations are expensive?

Joe Mallonee
Joe Mallonee
Numerade Educator
View

Problem 21

Discuss the techniques for allowing a hash file to expand and shrink dynamically. What are the advantages and disadvantages of each?

Nick Johnson
Nick Johnson
Numerade Educator
01:21

Problem 22

What are mixed files used for? What are other types of primary file organizations?

Adam Conner
Adam Conner
Numerade Educator
02:38

Problem 23

Consider a disk with the following characteristics (these are not parameters of any particular disk unit): block size $B=512$ bytes; interblock gap size $G=128$ bytes; number of blocks per track $=20 ;$ number of tracks per surface $=400 .$ A disk pack consists of 15 double-sided disks.
a. What is the total capacity of a track, and what is its useful capacity (excluding interblock gaps)?
b. How many cylinders are there?
c. What are the total capacity and the useful capacity of a cylinder?
d. What are the total capacity and the useful capacity of a disk pack?
e. Suppose that the disk drive rotates the disk pack at a speed of 2400 rpm (revolutions per minute $) ;$ what are the transfer rate $(t r)$ in bytes/msec and the block transfer time $(b t t)$ in msec? What is the average rotational delay $(r d)$ in msec? What is the bulk transfer rate? (See Appendix B.)
f. Suppose that the average seek time is 30 msec. How much time does it take (on the average) in msec to locate and transfer a single block, given its block address?
g. Calculate the average time it would take to transfer 20 random blocks, and compare this with the time it would take to transfer 20 consecutive blocks using double buffering to save seek time and rotational delay.

James Kiss
James Kiss
Numerade Educator
05:34

Problem 24

A file has $r=20,000$ stuDENT records of fixed length. Each record has the following fields: NAME (30 bytes), ssN (9 bytes), ADDRESS (40 bytes), PHONE (9 bytes), BIRTHDATE (8 bytes), sex (1 byte), MAJORDEPTCODE (4 bytes), MINORDEPTCODE (4 bytes), CLASSCODE (4 bytes, integer), and DECREEPROCRAM (3 bytes). An additional byte is used as a deletion marker. The file is stored on the disk whose parameters are given in Exercise 13.23
a. Calculate the record size $R$ in bytes.
b. Calculate the blocking factor $b$ fr and the number of file blocks $b$, assuming an unspanned organization.
c. Calculate the average time it takes to find a record by doing a linear search on the file if (i) the file blocks are stored contiguously, and double buffering is used; (ii) the file blocks are not stored contiguously.
d. Assume that the file is ordered by ssw; calculate the time it takes to search for a record given its ssn value, by doing a binary search.

Lucas Finney
Lucas Finney
Numerade Educator
05:27

Problem 25

Suppose that only 80 percent of the stuDENT records from Exercise 13.24 have a value for PHONE, 85 percent for MAJORDEPTCODE, 15 percent for MINORDEPTCOOE, and 90 percent for DECREEPROCRAM; and suppose that we use a variable-length record file. Each record has a 1 -byte field type for each field in the record, plus the I-byte deletion marker and a 1 -byte end-of-record marker. Suppose that we use a spanned record organization, where each block has a 5 -byte pointer to the next block (this space is not used for record storage).
a. Calculate the average record length $R$ in bytes.
b. Calculate the number of blocks needed for the file.

Samuel Goyette
Samuel Goyette
Numerade Educator
06:25

Problem 26

Suppose that a disk unit has the following parameters: seek time $s=20$ msec; rota tional delay $r d=10 \mathrm{msec} ;$ block transfer time $b t t=1 \mathrm{msec} ;$ block size $B=2400$ bytes; interblock gap size $G=600$ bytes. An EMPLOYEE file has the following fields:
$\mathrm{SSN}, 9$ bytes; LASTNAME, 20 bytes; fIRSTNAYE, 20 bytes; MIDOLE INIT$, 1$ byte; BIRTHOATE, 10 bytes; ADDRESS, 35 bytes; PHONE, 12 bytes; SUPERVISORSSN, 9 bytes; DEPARTMENT, 4 bytes; JOBCODE, 4 bytes; deletion marker, 1 byte. The EMPLOYEE file has $r=30,000$ records, fixed-length format, and unspanned blocking. Write appropriate formulas and cal. culate the following values for the above eMPLoyee file:
a. The record size $R$ (including the deletion marker), the blocking factor $b f r,$ and the number of disk blocks $b$
b. Calculate the wasted space in each disk block because of the unspanned orga nization.
c. Calculate the transfer rate $t r$ and the bulk transfer rate brr for this disk unit (see Appendix B for definitions of tr and btr).
d. Calculate the average number of block accesses needed to search for an arbitrary record in the file, using linear search.
e. Calculate in msec the average time needed to search for an arbitrary record in the file, using linear search, if the file blocks are stored on consecutive disk blocks and double buffering is used.
f. Calculate in msec the average time needed to search for an arbitrary record in the file, using linear search, if the file blocks are not stored on consecutive disk blocks.
g. Assume that the records are ordered via some key field. Calculate the average number of block accesses and the average time needed to search for an arbitrary record in the file, using binary search.

Robin Corrigan
Robin Corrigan
Numerade Educator
View

Problem 27

A PARTS file with Part* as hash key includes records with the following Part* val. ues: 2369,3760,4692,4871,5659,1821,1074,7115,1620,2428,3943,4750 $6975,4981,9208 .$ The file uses eight buckets, numbered 0 to 7. Each bucket is one disk block and holds two records. Load these records into the file in the given order, using the hash function $h(K)=K \bmod 8 .$ Calculate the average number of block accesses for a random retrieval on Part#.

James Kiss
James Kiss
Numerade Educator
View

Problem 28

Load the records of Exercise 13.27 into expandable hash files based on extendible hashing. Show the structure of the directory at each step, and the global and local depths. Use the hash function $h(K)=K \bmod 128$

James Kiss
James Kiss
Numerade Educator
View

Problem 29

Load the records of Exercise 13.27 into an expandable hash file, using linear hash. ing. Start with a single disk block, using the hash function $h_{0}=K \bmod 2^{0},$ and show how the file grows and how the hash functions change as the records are inserted. Assume that blocks are split whenever an overflow occurs, and show the value of $n$ at each stage.

James Kiss
James Kiss
Numerade Educator
View

Problem 30

Compare the file commands listed in Section 13.6 to those available on a file access method you are familiar with.

Victor Salazar
Victor Salazar
Numerade Educator
04:57

Problem 31

Suppose that we have an unordered file of fixed-length records that uses an unspanned record organization. Outline algorithms for insertion, deletion, and modification of a file record. State any assumptions you make.

Bryan Lynn
Bryan Lynn
Numerade Educator
01:31

Problem 32

Suppose that we have an ordered file of fixed-length records and an unordered overflow file to handle insertion. Both files use unspanned records. Outline algorithms for insertion, deletion, and modification of a file record and for reorganizing the file. State any assumptions you make.

Nick Johnson
Nick Johnson
Numerade Educator
02:49

Problem 33

Can you think of techniques other than an unordered overflow file that can be used to make insertions in an ordered file more efficient?

Joe Mallonee
Joe Mallonee
Numerade Educator
02:49

Problem 34

Suppose that we have a hash file of fixed-length records, and suppose that overflow is handled by chaining. Outline algorithms for insertion, deletion, and modification of a file record. State any assumptions you make.

Joe Mallonee
Joe Mallonee
Numerade Educator
View

Problem 35

Can you think of techniques other than chaining to handle bucket overflow in external hashing?

Nick Johnson
Nick Johnson
Numerade Educator
02:37

Problem 36

Write pseudocode for the insertion algorithms for linear hashing and for extendible hashing.

Bryan Lynn
Bryan Lynn
Numerade Educator
03:06

Problem 37

Write program code to access individual fields of records under each of the following circumstances. For each case, state the assumptions you make concerning pointers, separator characters, and so forth. Determine the type of information needed in the file header in order for your code to be general in each case.
a. Fixed-length records with unspanned blocking.
b. Fixed-length records with spanned blocking.
c. Variable-length records with variable-length fields and spanned blocking.
d. Variable-length records with repeating groups and spanned blocking.
e. Variable-length records with optional fields and spanned blocking.
f. Variable-length records that allow all three cases in parts $c, d,$ and e.

Foster Wisusik
Foster Wisusik
Numerade Educator
View

Problem 38

Suppose that a file initially contains $r=120,000$ records of $R=200$ bytes each in an unsorted (heap) file. The block size $B=2400$ bytes, the average seek time $s=$ $16 \mathrm{ms}$, the average rotational latency $r d=8.3 \mathrm{ms}$ and the block transfer time $b t t=$ $0.8 \mathrm{ms} .$ Assume that 1 record is deleted for every 2 records added until the total number of active records is 240,000
a. How many block transfers are needed to reorganize the file?
b. How long does it take to find a record right before reorganization?
c. How long does it take to find a record right after reorganization?

James Kiss
James Kiss
Numerade Educator
06:58

Problem 39

Suppose we have a sequential (ordered) file of 100,000 records where each record is 240 bytes. Assume that $B=2400$ bytes, $s=16 \mathrm{ms}, r d=8.3 \mathrm{ms},$ and $b t t=0.8 \mathrm{ms}$ Suppose we want to make $X$ independent random record reads from the file. We could make $X$ random block reads or we could perform one exhaustive read of the entire file looking for those $X$ records. The question is to decide when it would be more efficient to perform one exhaustive read of the entire file than to perform $x$ individual random reads. That is, what is the value for $X$ when an exhaustive read of the file is more efficient than random $X$ reads? Develop this as a function of $X$

Neel Faucher
Neel Faucher
Numerade Educator
06:25

Problem 40

Suppose that a static hash file initially has 600 buckets in the primary area and that records are inserted that create an overflow area of 600 buckets. If we reorganize the hash file, we can assume that the overflow is eliminated. If the cost of reorganizing the file is the cost of the bucket transfers (reading and writing all of the buckets ) and the only periodic file operation is the fetch operation, then howmany times would we have to perform a fetch (successfully) to make the reorganization cost-effective? That is, the reorganization cost and subsequent search cost are less than the search cost before reorganization. Support your answer. Assume $s=16 \mathrm{ms}, r d=8.3 \mathrm{ms}, b t t=1 \mathrm{ms}$

Robin Corrigan
Robin Corrigan
Numerade Educator
View

Problem 41

Suppose we want to create a linear hash file with a file load factor of 0.7 and a block. ing factor of 20 records per bucket, which is to contain 112,000 records initially.
a. How many buckets should we allocate in the primary area?
b. What should be the number of bits used for bucket addresses?

James Kiss
James Kiss
Numerade Educator