Re: left outer join terrible slow compared to inner join - Mailing list pgsql-general

From Tom Lane
Subject Re: left outer join terrible slow compared to inner join
Date
Msg-id 4774.1062094215@sss.pgh.pa.us
Whole thread Raw
In response to Re: left outer join terrible slow compared to inner join  (Thomas Beutin <tyrone@laokoon.IN-Berlin.DE>)
Responses Re: left outer join terrible slow compared to inner join
List pgsql-general
Thomas Beutin <tyrone@laokoon.IN-Berlin.DE> writes:
> Thanks for the suggestion, but the result is close to the original outer
> join without the explicit cross join but far away from the speed of the
> inner join.

> EXPLAIN ANALYZE SELECT DISTINCT pz.l1_id, pz.l2_id, pz.l3_id, pz.l4_id FROM ( ot_adresse AS a CROSS JOIN ot_produkt
ASp) LEFT OUTER JOIN  ot_kat_prod AS pz ON ( p.p_id = pz.p_id ) WHERE  p.a_id = a.id AND a.id = '105391105424941' AND
a.m_id= '37'; 
> NOTICE:  QUERY PLAN:

>               ->  Subquery Scan pz  (cost=0.00..1683.51 rows=40851 width=170) (actual time=0.03..485.07 rows=40917
loops=11)
>                     ->  Seq Scan on o_kat_prod  (cost=0.00..1683.51 rows=40851 width=170) (actual time=0.02..281.77
rows=40917loops=11) 

Hmm, I don't understand why ot_kat_prod is being treated as a subquery
here.  It isn't a view or something is it?

            regards, tom lane

pgsql-general by date:

Previous
From: Thomas Beutin
Date:
Subject: Re: left outer join terrible slow compared to inner join
Next
From: "Clay Luther"
Date:
Subject: Re: left outer join terrible slow compared to inner join