Tim Jacobs <tjacobs2@xxxxxxxxxxxxx> 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 -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance