pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Drew <drewmwilson@fastmail.fm>
Cc: pgsql-sql@postgresql.org
Subject: Re: query faster using LEFT OUTER join?
Date: Mon, 20 Nov 2006 08:29:24 +0000
Message-ID: <45616764.1040902@archonet.com> (raw)
In-Reply-To: <B8825A6D-229D-4130-9091-7386F2B383DD@fastmail.fm>
References: <B8825A6D-229D-4130-9091-7386F2B383DD@fastmail.fm>

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



view thread (2+ messages)

Message-ID: <45616764.1040902@archonet.com>
Permalink:  ../45616764.1040902@archonet.com/
Also on:    postgresql.org/message-id/45616764.1040902@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, drewmwilson@fastmail.fm
  Subject: Re: query faster using LEFT OUTER join?
  In-Reply-To: <45616764.1040902@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox