Docsity

Solved Assignment 4 - Database Systems | CSCI 4380, Assignments of Deductive Database Systems

Toggle sidebar
bg1
Alex Jewell
CSCI-4380
Database Systems
Professor Zaki
3/29/09
Assignment 4
13.2.1
a)
10 surfaces
100,000 tracks
1,000 sectors
1024 bytes
10 ร—100000 ร—1000 ร—1024 ร— .8 = 1.024 ร—1012 ๐‘๐‘ฆ๐‘ก๐‘’๐‘ 
c)
100,000 tracks
1 + .0002N ms for N tracks
100,000 ร— .0002 + 1 = 21๐‘š๐‘ 
d)
10,000rpm
60๐‘ 
10,000๐‘Ÿ๐‘’๐‘๐‘ = .006๐‘ 
13.5.3
NOTE: I used the following sizes. SQL Date = 10 bytes, SQL Time = 8 bytes, based on values found in the
book.
4 byte pointer, 1 char, 15 char string, 2 byte int, SQL Date, SQL Time
a) ๐Ÿ’+๐Ÿ+๐Ÿ๐Ÿ“+๐Ÿ+๐Ÿ๐ŸŽ+๐Ÿ–=๐Ÿ’๐ŸŽ ๐’ƒ๐’š๐’•๐’†๐’”
b) ๐Ÿ’+๐Ÿ’+๐Ÿ๐Ÿ”+๐Ÿ’+๐Ÿ๐Ÿ+๐Ÿ–=๐Ÿ’๐Ÿ– ๐’ƒ๐’š๐’•๐’†๐’”
c) ๐Ÿ–+๐Ÿ–+๐Ÿ๐Ÿ”+๐Ÿ–+๐Ÿ๐Ÿ”+๐Ÿ–=๐Ÿ”๐Ÿ’ ๐’ƒ๐’š๐’•๐’†๐’”
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Solved Assignment 4 - Database Systems | CSCI 4380 and more Assignments Deductive Database Systems in PDF only on Docsity!

Alex Jewell CSCI- Database Systems Professor Zaki 3/29/

Assignment 4

a)

10 surfaces 100,000 tracks 1,000 sectors 1024 bytes

10 ร— 100000 ร— 1000 ร— 1024 ร— .8 = 1.024 ร— 10^12 ๐‘๐‘ฆ๐‘ก๐‘’๐‘ 

c)

100,000 tracks 1 + .0002 N ms for N tracks

100,000 ร— .0002 + 1 = 21๐‘š๐‘ 

d)

10,000rpm 60 ๐‘  10,000๐‘Ÿ๐‘’๐‘๐‘ 

NOTE: I used the following sizes. SQL Date = 10 bytes, SQL Time = 8 bytes, based on values found in the book.

4 byte pointer, 1 char, 15 char string, 2 byte int, SQL Date, SQL Time

a)

b)

c)

3 static fields of 10 bytes each. 30 bytes.

Integer, record length. 4 bytes

2 integer pointers to the last 2 of the 3 variable length fields. 8 bytes

Average of name 10-50 bytes. 30 bytes.

Average of address 20-80 bytes. 50 bytes.

Average of history 0-1000 bytes. 500 bytes.

30 + 4 + 8 + 30 + 50 + 500 = 622 ๐‘๐‘ฆ๐‘ก๐‘’๐‘ 

i) Deleting each node from 23 requires removing nodes as the reach less than 50% capacity. This is rather straightforward until we reach the last number to remove which will cause the parent node and then the root node to reach less than 50% capacity.

13

7

2 3 5 7 11 13 17 19 47

19

As you can see, when 47 is removed, 19 is combined with the node to the left, and the parent node reaches less than 50%, and removing it would cause the root node to have less than 50% capacity. So the root node is combined down with the node containing 7.

7 13

2 3 5 7 11 13 17 19

0000 0001

3

0010 0011

3

0100 0101

3

0110 0111

3

1000 1001

3

1010 1011

3

1100 1101

3

1110 1111

3

0000 1000

0001 10001

0010 1010

0011 1011

0100 1100

0101 1101

0110 1110

0111 1111

c) d)

a) Set Union

b) Simple Sort Join

c) Efficient Sort-Join

a) Clustering Index

b) Non clustering Index

c) R is clustered, index not used

b) ๐ˆ๐’‚=๐Ÿ๐ŸŽ ๐‘พ

๐‘‡ ๐œŽ๐‘Ž=10 ๐‘Š =

d) ๐ˆ๐’„=๐Ÿ๐ŸŽ(๐’€) โ‹ˆ ๐’

๐‘‡ ๐œŽ๐‘=20 ๐‘Œ ๐‘‡ ๐‘ max ๐‘‰ ๐‘Œ, ๐‘‘ , ๐‘‰ ๐‘, ๐‘‘

max ๐‘‰ ๐‘Œ, ๐‘‘ , ๐‘‰ ๐‘, ๐‘‘

6 ร— 400

f) ๐ˆ๐’…>๐Ÿ๐ŸŽ ๐’

๐‘‡ ๐œŽ๐‘‘>10 ๐‘ = ๐‘‡ ๐‘ /

3 โ‰ˆ^133

h) ๐ˆ๐’‚=๐Ÿ๐ŸŽ ๐‘จ๐‘ต๐‘ซ ๐’ƒ>๐Ÿ ๐‘พ

๐‘‡ ๐œŽ๐‘Ž=10 ๐ด๐‘๐ท ๐‘>2 ๐‘Š =

๐‘‰ ๐‘Š, ๐‘Ž ร— 3

20 ร— 3 =

a) ๐ˆ๐’‚=๐Ÿ ๐‘จ๐‘ต๐‘ซ ๐’ƒ=๐Ÿ ๐‘จ๐‘ต๐‘ซ ๐’…=๐Ÿ‘(๐‘น) i) Table Scan: ๐ต ๐‘… = 1000 ๐ผ/๐‘‚โ€ฒ๐‘ 

ii) Index scan on a: (^) ๐‘‰ ๐‘…๐ต ๐‘…,๐‘Ž = 100020 = 50 ๐ผ/๐‘‚โ€ฒ๐‘ 

iii) Index scan on b: (^) ๐‘‰ ๐‘…๐‘‡ ๐‘…,๐‘ = 50001000 = 5 ๐ผ/๐‘‚โ€ฒ๐‘ 

iv) Index scan on d: (^) ๐‘‰ ๐‘…๐‘‡ ๐‘…,๐‘‘ = 5000500 = 10 ๐ผ/๐‘‚โ€ฒ๐‘ 

ANSWER): Index scan on b: 5

b) ๐ˆ๐’‚=๐Ÿ ๐‘จ๐‘ต๐‘ซ ๐’ƒ=๐Ÿ ๐‘จ๐‘ต๐‘ซ ๐’„โ‰ฅ๐Ÿ‘(๐‘น) i) Table Scan: ๐ต ๐‘… = 1000 ๐ผ/๐‘‚โ€ฒ๐‘ 

ii) Index scan on a: (^) ๐‘‰ ๐‘…๐ต ๐‘…,๐‘Ž = 100020 = 50 ๐ผ/๐‘‚โ€ฒ๐‘ 

iii) Index scan on b: (^) ๐‘‰ ๐‘…๐‘‡ ๐‘…,๐‘ = 50001000 = 5 ๐ผ/๐‘‚โ€ฒ๐‘ 

iv) Index scan on c: ๐‘‡ ๐‘… 3 = 50003 โ‰ˆ 1667 ๐ผ/๐‘‚โ€ฒ๐‘ 

ANSWER): Index scan on b: 5

c) ๐ˆ๐’‚=๐Ÿ ๐‘จ๐‘ต๐‘ซ ๐’ƒโ‰ค๐Ÿ ๐‘จ๐‘ต๐‘ซ ๐’„โ‰ฅ๐Ÿ‘(๐‘น) i) Table Scan: ๐ต ๐‘… = 1000 ๐ผ/๐‘‚โ€ฒ๐‘ 

ii) Index scan on a: (^) ๐‘‰ ๐‘…๐ต ๐‘…,๐‘Ž = 100020 = 50 ๐ผ/๐‘‚โ€ฒ๐‘ 

iii) Index scan on b: ๐‘‡ ๐‘… 3 = 50003 โ‰ˆ 1667 ๐ผ/๐‘‚โ€ฒ๐‘ 

iv) Index scan on c: ๐‘‡ ๐‘… 3 = 50003 โ‰ˆ 1667 ๐ผ/๐‘‚โ€ฒ๐‘ 

ANSWER): Index scan on a: 50