Richard, are you planning to review this any more? I'm getting a little antsy to get it committed. For such a large patch, it's surprising it's had so few conflicts to date.
Sorry for the delayed reply. I don't have any more review comments at the moment, except a nitpicking one.
In optimizer/README at line 729 there is a query as
SELECT * FROM a LEFT JOIN (SELECT * FROM b WHERE b.z = 1) ss ON (a.x = b.y) WHERE a.x = 1;
I think it should be
SELECT * FROM a LEFT JOIN (SELECT * FROM b WHERE b.z = 1) ss ON (a.x = ss.y) WHERE a.x = 1;