On Wed, Jun 4, 2014 at 12:50 AM, Noah Misch <noah@leadboat.com> wrote:
As a point of procedure, I recommend separating the semijoin support into its
own patch. Your patch is already not small; delaying non-essential parts will make the essential parts more accessible to reviewers.
In the attached patch I've removed all the SEMI and ANTI join removal code and left only support for LEFT JOIN removal of sub-queries that can be proved to be unique on the join condition by looking at the GROUP BY and DISTINCT clause.
Example:
SELECT t1.* FROM t1 LEFT OUTER JOIN (SELECT value,COUNT(*) FROM t2 GROUP BY value) t2 ON t1.id = t2.value;