Antonin Houska <antonin.hou...@gmail.com> writes: > debug_print_plan output contains > :grpColIdx 2 > in the AGG node.
Hm, that means there's only one grouping column (and it's the second tlist entry of the child plan node). So that seems conclusive that the unique-ification is being done wrong. It's not very clear why though. It doesn't seem like your patch is doing anything that would directly affect that. For comparison purposes, using the patch I just posted, I get this description of a correct plan: regression=# explain verbose SELECT * FROM SUBSELECT_TBL upper WHERE (f1, f2::float) IN (SELECT f2, f3 FROM SUBSELECT_TBL); QUERY PLAN ---------------------------------------------------------------------------------------------------- Hash Join (cost=41.55..84.83 rows=442 width=16) Output: upper.f1, upper.f2, upper.f3 Hash Cond: ((upper.f1 = subselect_tbl.f2) AND ((upper.f2)::double precision = subselect_tbl.f3)) -> Seq Scan on public.subselect_tbl upper (cost=0.00..27.70 rows=1770 width=16) Output: upper.f1, upper.f2, upper.f3 -> Hash (cost=38.55..38.55 rows=200 width=12) Output: subselect_tbl.f2, subselect_tbl.f3 -> HashAggregate (cost=36.55..38.55 rows=200 width=12) Output: subselect_tbl.f2, subselect_tbl.f3 Group Key: subselect_tbl.f2, subselect_tbl.f3 -> Seq Scan on public.subselect_tbl (cost=0.00..27.70 rows=1770 width=12) Output: subselect_tbl.f1, subselect_tbl.f2, subselect_tbl.f3 (12 rows) so it's unique-ifying on both f2 and f3, which is clearly necessary for executing the IN with a plain join. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers