Indexing: ICE1

advertisement
Indexing: ICE1
• Consider a disk with average I/O time
20msec and page size = 1024 bytes
• Table: 200,000 rows of 100 bytes each, no
row spans 2 pages
• Find:
– Number of pages needed to store the table
– Time to read all rows sequentially
– Time to read all rows in some random order
1
ICE2: Compute query time
•
SELECT * FROM Product WHERE Price
between 5 and 10
1. Is a hash index useful in this case? Why?
2. Compute time needed to evaluate query
assuming 20% of data satisfies condition, disk
with average I/O time 20msec, page size =
1024 bytes,200,000 rows of 100 bytes each,
no row spans 2 pages
1. If no index exists
2. Clustered B+tree index on Price exists
3. Not-clustered B+tree index on Price exists
2
ICE3: SQL
•
Write an SQL statement to display SKU
and Description for all products having a
description that includes the word
‘Scuba’
ICE4: SQL
•
Write an SQL statement to display each
warehouse name and the total
QuantityOnHand for that warehouse.
Name the total TotalItemsOnHand and
display the results in descending order of
TotalItemsOnHand
3
Download