Question

In: Computer Science

Consider the “index calculation” problem we have studied in the class (see lecture note), where we...

Consider the “index calculation” problem we have studied in the class (see lecture note), where we have a relation of 8,000,000 tuples. Again, make the following assumptions:

  • the size of disk block (also called disk page): it is usually 4K or 8K bytes, to make our calculation easier, we will use 4000 bytes as a block size
  • the size of the search key value: say we index the relation by using an attribute that is part of the primary key, and it is 40 byte string
  • the size of physical page addresses: this is needed since every node in the tree will store search key values as well as references to disk pages, i.e., the address of the disk page being referenced. For ease of calculation, we use a 10-byte page address
  • each swap takes about 10 milliseconds
  1. For this relation, calculate how long it will take to find a particular record if we use dense index, as

described by databaseSystems-71-indexing, page 2? [16 points]

  1. Consider again the situation in question 1, with the same dense index, but add one extra level of sparse index, as described by databaseSystems-71-indexing, page 5 – 6. Now, how long it will take to find one particular record? [16 points]

Solutions

Expert Solution

No of records = 800000

Disk Block Size = 4000B

Key = 40B

Page address size = 10B

Swap time = 10ms

1)Use Dense Indexing (level 1)

No of entry in index = no of rewards (dense)

No of entries in index table = 800000

size of each entry in index table = key + address size

= 40 + 10 = 50B

Number of blocks to search in index table =

= 22.9315 units = 23 units

2)Using level 2 index table with sparse indexing

no of records in level 1 of index = 800000

size of records in level 1 of index = 50B

no of entries in index which can be stored in 1 block = Block size / record size of level 1 index

= 4000 / 50 = 80

no of blocks needed for level 1 index = 800000 / 80 = 100000

For level2 indexing, 100000 entries are required since number of blocks at level1 are 100000 &

we use sparse index here.

No of blocks to search in level2 = = 16.6 17

Total no of blocks to search = 17+1+1 = 19

Total time = 19*10ms = 190ms.


Related Solutions

. Consider the two-firm game of sequential quantity competition that we studied in class. (See slides...
. Consider the two-firm game of sequential quantity competition that we studied in class. (See slides 33-38 in the “Homogeneous products oligopoly.”) Suppose firm A gets to make one more move after firm B makes its choice of QA, but before price and profits are determined. That is, the order of events will be: C(Qi) = 10Qi --> for firms B and A Demand --> P = 40 – 0.01(QA + QB ) i. Firm A announces QA. ii. Firm...
Describe a scenario/design where a polymorphic behavior is utilized. In the lecture this week we studied...
Describe a scenario/design where a polymorphic behavior is utilized. In the lecture this week we studied an example in which we defined a GeometricObject as the base class and added features to this base class to define two specialized classes, namely the Circle and the Rectangle classes. Your design should have the design elements of the example we studied but it doesn’t have to be related to geometric shapes. Clearly list the functions in the base class you would declare...
In reference to the lecture we had about the yield curve, the lecture note and the...
In reference to the lecture we had about the yield curve, the lecture note and the video posted in the topic 1 folder in the Course materials, discuss: 1. What is inverted yield curve? (2 points) 2. Why is it interpreted as the sign of imminent recession? (4 points) 3. What causes the inverted yield curve? (4 points) It is absolutely crucial to provide the logical reasoning & the schematic account of the financial market process.
Write in Java! (Not Javascript) Consider the LinkedList class we discussed in class (see the slides...
Write in Java! (Not Javascript) Consider the LinkedList class we discussed in class (see the slides for lecture 8). Add the following methods to the class and submit the completed LinkedList class. int size() which returns the size of the linked list Link getElementByIndex(int index) which returns the Link/node specified by the index. For example, getElementByIndex(0) should return the first Link, getElementByIndex(2) should return the third Link. If index is not in range, your method should return null. boolean hasDuplicate()...
In class, we have studied the bisection method for finding a root of an equation. Another...
In class, we have studied the bisection method for finding a root of an equation. Another method for finding a root, Newton’s method, usually converges to a solution even faster than the bisection method, if it converges at all. Newton’s method starts with an initial guess for a root, ?0 , and then generates successive approximate roots ?1 , ?2 , …. ?i , ?i+i, …. using the iterative formula?′(?௝) Where ?’(xi) is the derivative of function ? evaluated at...
In this class we have studied numerous financial crises in developing countries. While each of these...
In this class we have studied numerous financial crises in developing countries. While each of these crises is different, there are patterns that re-occur and mistakes that are repeated over and over again. 1) Define and discuss what is a financial crisis? (Hint: there is no definitive answer.) 2) Why are developing countries more vulnerable to financial crises? 3) What is the typical pattern for a financial crisis? 4) What role has the IMF played in financial crises in developing...
In the context of the two- period model without leisure we have studied in class, Define...
In the context of the two- period model without leisure we have studied in class, Define a competitive equilibrium as carefully as possible and indicate the elements involved in the definition. Make sure you clearly explain the problem and the the exogenous/endogenous variables for each decision maker.
Now that we have studied the various types of vaccines, consider the current resurgence of diseases...
Now that we have studied the various types of vaccines, consider the current resurgence of diseases like the measles. How can we convince the general public and possibly even ourselves, that immunization is a necessary preventative measure for diseases that have serious complications? Is there a different schedule that we should consider? Are some forms of vaccines safer than others? Should we spread out the inoculation schedule to prevent confusion of a young person? (Include terms such as live attenuated,...
Using class, write a program that: Body Mass Index (BMI) calculation - write a program that...
Using class, write a program that: Body Mass Index (BMI) calculation - write a program that takes users' input (weight and Height) and calculates the BMI. If the result is less than 18.5 display "you are underweight", if the result is greater than 18.5 display "you have a normal weight", if the result is greater than 24.9 display "your weight is considered overweight", and the result is greater than 30 display "your weight is considered as obese" (BMI = 703...
: Recall the airplane cargo problem we have discussed in our first lecture. An air-freight company...
: Recall the airplane cargo problem we have discussed in our first lecture. An air-freight company has 8 adjacent positions on its Boeing-727 aircraft for freight containers. The weights of this containers depend on what they are carrying. and company statistics indicate that %7 of the containers are classified as ”heavy”. While heavy containers are not inherently dangerous, having two such containers next to each other is considered dangerous should the plane encounter a wind gust. Understandably, company wants to...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT