pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: Tim Jacobs <tjacobs2@email.unc.edu>
To: pgsql-performance@postgresql.org
Subject: Re: Why is a hash join being used?
Date: Fri, 22 Jun 2012 10:59:44 -0500
Message-ID: <4FE4502002000025000489DA@gw.wicourts.gov> (raw)
In-Reply-To: <9D1AF2AE-9605-41B5-8BCC-177B5EF6F1A5@gmail.com>
References: <9D1AF2AE-9605-41B5-8BCC-177B5EF6F1A5@gmail.com>

Tim Jacobs <tjacobs2@email.unc.edu> wrote:
 
> The nested loop join performs very quickly, whereas the hash join
> is incredibly slow. If I disable the hash join temporarily then a
> nested loop join is used in the second case and is the query runs
> much more quickly. How can I change my configuration to favor the
> nested join in this case? Is this a bad idea?
 
Before anyone can make solid suggestions on what you might want to
change in your configuration, they would need to know more.  Please
read this page:
 
http://wiki.postgresql.org/wiki/SlowQueryQuestions
 
... and repost with your PostgreSQL version, your configuration
overrides, a description of your hardware, and EXPLAIN ANALYZE
output from the query (rather than just EXPLAIN output).
 
You might not be modeling your costs correctly, you might not be
allocating resources well, you might be on an old version without an
optimizer as smart as more recent versions, your statistics might be
out of date, or you might be running into an optimizer weakness of
some sort.
 
-Kevin



view thread (3+ messages)

Message-ID: <4FE4502002000025000489DA@gw.wicourts.gov>
Permalink:  ../4FE4502002000025000489DA@gw.wicourts.gov/
Also on:    postgresql.org/message-id/4FE4502002000025000489DA@gw.wicourts.gov

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: Kevin.Grittner@wicourts.gov, tjacobs2@email.unc.edu
  Subject: Re: Why is a hash join being used?
  In-Reply-To: <4FE4502002000025000489DA@gw.wicourts.gov>
  References: <9D1AF2AE-9605-41B5-8BCC-177B5EF6F1A5@gmail.com> <4FE4502002000025000489DA@gw.wicourts.gov>

* 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