>>>>> "Andrew" == Andrew Gierth <andrew@xxxxxxxxxxxxxxxxxxxx> writes: Andrew> Unfortunately, the planner isn't smart enough yet to know that Andrew> these two are equivalent, oops, I edited the second one before posting in a way that made them not be equivalent: adding a "group by x0.item_id" in both subqueries in method 2 makes them equivalent again. Without that, the result differs slightly if there are no matching color or image rows (NULL vs. empty array). -- Andrew (irc:RhodiumToad)