Selectivity of `emp.salary 40000'
Selectivity of `emp.age 30'
Tuple cardinality is thus
Cost of segment scan
Cost of index scan on since is a clustered index.
is a unclustered index. The number of page accesses
.
However, note that the number of distinct pages of EMP is only 1000, which can completely fit in main memory. So even in the worst case -- that is, if the 40-year old employees, who are estimated to be 2500 in number, are spread sequentially across all these pages, with a new page accessed each time, there can be at most 1000 disk accesses.
Therefore, the maximum number of disk IOs with is
Overall, the index scan on is the best option and the optimizer will choose that option.
(a) For relation , the partition of the relation is based on the values of .
(b) and (c) The following algorithm can be used to generate samples and compute the value of RandomSample():
For example, let the STUDENT relation have tuples
Finally, in the last computation of , the value of is simply .
It can be worked out to see that the above solution also provides quality guarantees similar to one provided in the sampling paper.
YES, the claim is correct.
Given the file construction parameters of , it means that the file grows as follows, measured in quanta sizes: . This means that the currently assigned segment size ( ) will be always equal to the sum of the sizes of the previous assignments. Since the while loop in A2 goes backwards through the segments, and assuming a uniformly randomizing hash function, it means that the probability of finding the required address in 1 iteration is 0.5, in 2 iterations is 0.25, in 3 is 0.125, and so on. Therefore the expected number of iterations is approximately , which is a convergent series bounded above by 2.
The closest point in P4 that covers ALL points in P1 is 40. Therefore,
is 40/10 - 1 = 3.
The closest point in P4 that covers ALL points in P2 is 80. Therefore,
is 80/16 - 1 = 4.
The closest point in P4 that covers ALL points in P3 is 70. Therefore,
is 70/30 - 1 = 1.33.
Therefore, the lowest overall
value is max (3,4,1.33) = 4.
(a) The minimum number of components corresponds to the smallest space-optimal index that meets the budget requirement. For a space-optimal range-encoded index, the number of bitmaps is where and is the smallest integer such .
In the given problem, since the domain is 101 ...1100. Therefore, the minimum number of components corresponds to since , and the bitmap consumption is = 27 which is less than 40. (With two components, , and consumption is , which is more than 40.)
The specific space-optimal index is .
(b) For the time-optimal index, the minimum number of components is since this corresonds to an index , whose space consumption is 36. The time metric for a time-optimal index is leading to = 6.3 bitmap scans.
Transaction | lastLSN | status | undoNxtLSN |
100 | aborted | 100 | |
70 | running | - |
Page Id | recLSN |
20 | |
40 | |
50 | |
70 |
LSN | LOG | undoNextLSN |
110 | CLR: Undo T2 LSN 90 | 40 |
120 | CLR: Undo T3 LSN 70 | 50 |