跳转到内容

Fatworm 2014:Code Review 2

来自ACM Class Wiki

time & place

Time: June 6th, 4 pm

Location: 601 Zhiyuan

requirement

1 finish physical scan

2 finish storage and your file system

3 finish index (preferably B+ tree with integer keys) and other optimisation

4 run at least one test case

5 answer questions

questions

1. How do your format a record into a page?

2. If the length of a record exceeds the size of a single page, how do you deal with it?

3. How can you locate a specified record in your storage?

4. How do you store a record with a field type VARCHAR?

5. When deleting a record, what happens in your storage (Don't consider indexes here)?

6. When a table has indexes, what happens to basic operations like record insertion, deletion, update?

7. You want to do a natural join, say select * from a, b where a.a = b.b, and a has an index on a, as well as b has an index on b. How can these indexes help you to accelerate this natural join operation?

8. How do you deal with a B+ tree with VCHAR keys?

9. How do you construct a B+ tree on a table already with some records in it?

10. You want to do a natural join, say select * from a, b where a.a = b.b, and Table a has an index on a, and b in Table b is int primary key auto_inc. How can you use the index to accelerate this natural join operation?

11. How do you deal with: select * from A where exists (select * from B where A.a = B.b); ? (There is no "from A" in the subquery)

12. How do you deal with: select min(a) + max(b) from test; ? (There is no “Group”, and functions are in an expression)

13. Where do you store your tuples when you want to sort them?

14. How do you perform a “DISTINCT” operation? Using Sort?

15. How do you deal with: select from a where a.a>3 and a.a<6; When there is an index on a.a?

16. What happens if you add an Int to a Decimal?

17. What happens to the file system if you delete a tuple in a table?

18. When should you perform the sort in SortScan? At beforeFirst()? At next()? At SortScan()?

19. There is a "int distinctValues(String fldname)" method in SimpleDB that estimates the distinct number of field values in the result of the plan, why is this necessary?

20. Where did you use interface(“implements") and inheritance(“extends”) in this project?