Re: Reference to parent query from ANY sublink

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Reference to parent query from ANY sublink
Дата
Msg-id 16862.1386805758@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Reference to parent query from ANY sublink  (Antonin Houska <antonin.houska@gmail.com>)
Ответы Re: Reference to parent query from ANY sublink
Список pgsql-hackers
Antonin Houska <antonin.houska@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.83rows=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=1770width=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              ->
SeqScan 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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Antonin Houska
Дата:
Сообщение: Re: Reference to parent query from ANY sublink
Следующее
От: desmodemone
Дата:
Сообщение: Re: In-Memory Columnar Store