Announcements ----------------- - Last question on Lecture Exercise 21 was on a topic we did not cover. We will not grade it in LE21, but we will move that question to LE22 from today's lecture. - New homework by tomorrow, due on thursday after Thanksgiving ----------------------- What determines the speed of queries (if DB and queries are fixed)? How much memory you have! Given enough memory, many operations can be done in one pass. If not enough memory, use either - sorting - hashing to reduce the complexity of operations. Sorting ---------- Given PAGES(R)>>M Step 1: Read R in M blocks at a time, sort and write to disk (in a temporary location) Cost: PAGES(R) * 2 (one read and one write) Step 2: Merge M sorted groups, by reading the lowest page from each group, merge in memory and output If number of sorted groups is less than or equal to M, we can output to buffer.