As a general guideline, Java becomes incredibly slow once you hit 50% memory usage as you spend more time in the garbage collector than in your code.
Professor's note: For an illustration of the potential benefits of a longer CREATE TABLE step, have a look at the leaderboards for Checkpoint 1.
JSQLParser also supports more expressive limit clauses (e.g., including offsets). You will not be required to support anything more complex than LIMIT N.
If you used iterators for checkpoint 1, you should just be able to replace a Table Scan iterator with the iterator you construct for the nested query
Iterator optimize(Iterator query) {
if(query instanceof Filter){
Filter f = (Filter)query;
if(f.input instanceof Project){
Project p (Project)f.input;
// replace query with a new pair of iterators where
// the Project uses the Filter as an input.
}
}
// Recur
query.input = optimize(query.input);
return query;
}