pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ksenia Marasanova <ksenia.marasanova@gmail.com>
To: pgsql-performance@postgresql.org
Subject: LEFT JOIN optimization
Date: Sun, 11 Sep 2005 20:12:58 +0300
Message-ID: <130df19305091110125a2d174f@mail.gmail.com> (raw)

Hi list,

I don't have much experience with Postgres optimization, somehow I was
happily avoiding anything more difficult than simple select statement,
and it was working all right.

Now LEFT JOIN must be used, and I am not happy with the performance:
It takes about 5 seconds to run very simple LEFT JOIN query on a table
"user_" with ~ 13.000 records left joined to table "church" with ~ 300
records on Powerbook PPC 1.67 GHz with 1.5 GB ram.
Is it normal?

Some details:

test=# explain select * from user_ left join church on user_.church_id
= church.id;
                             QUERY PLAN                              
---------------------------------------------------------------------
 Hash Left Join  (cost=6.44..7626.69 rows=12763 width=325)
   Hash Cond: ("outer".church_id = "inner".id)
   ->  Seq Scan on user_  (cost=0.00..7430.63 rows=12763 width=245)
   ->  Hash  (cost=5.75..5.75 rows=275 width=80)
         ->  Seq Scan on church  (cost=0.00..5.75 rows=275 width=80)
(5 rows)




view thread (5+ messages)  latest in thread

Message-ID: <130df19305091110125a2d174f@mail.gmail.com>
Permalink:  ../130df19305091110125a2d174f@mail.gmail.com/
Also on:    postgresql.org/message-id/130df19305091110125a2d174f@mail.gmail.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-performance@postgresql.org
  Cc: ksenia.marasanova@gmail.com
  Subject: Re: LEFT JOIN optimization
  In-Reply-To: <130df19305091110125a2d174f@mail.gmail.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