Re: left outer join terrible slow compared to inner join

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Beutin <tyrone(at)laokoon(dot)IN-Berlin(dot)DE>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: left outer join terrible slow compared to inner join
Date: 2003-08-28 18:10:15
Message-ID: 4774.1062094215@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thomas Beutin <tyrone(at)laokoon(dot)IN-Berlin(dot)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 AS p) 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=40917 loops=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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Clay Luther 2003-08-28 18:26:16 Re: left outer join terrible slow compared to inner join
Previous Message Thomas Beutin 2003-08-28 16:53:25 Re: left outer join terrible slow compared to inner join