Re: query faster using LEFT OUTER join?

From: Richard Huxton <dev(at)archonet(dot)com>
To: Drew <drewmwilson(at)fastmail(dot)fm>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: query faster using LEFT OUTER join?
Date: 2006-11-20 08:29:24
Message-ID: 45616764.1040902@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Drew wrote:
> I have a planner question about a multi-join query, where if I rewrite
> the query excluding the table that is left joined to the other tables my
> query speed increases by 75%.

> Here's the plan for the first query (using 8.2b3)
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> HashAggregate (cost=3223.17..3223.41 rows=19 width=18) (actual
> time=34.913..34.978 rows=122 loops=1)

> And here's the plan for the second query without the first LEFT OUTER
> join (using 8.2b3)
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> HashAggregate (cost=8927.87..8936.89 rows=721 width=18) (actual
> time=39.484..39.551 rows=122 loops=1)

Query1: 34.9ms
Query2: 39.5ms

I'm not seeing a huge difference here. Are these the right EXPLAINs?

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Rajesh Kumar Mallah 2006-11-20 09:09:32 tsvector_eq appears to be inconsistent.
Previous Message Chris Tennant 2006-11-19 23:20:49 Re: planner used functional index in 7.3.6, now does a seq