pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ross J. Reedstrom <reedstrm@rice.edu>
To: pgsql-sql@postgresql.org
Subject: Re: [SQL] Selecting with a large number of foreign keys
Date: Tue, 04 May 1999 16:08:04 -0500
Message-ID: <372F61B4.AC6BD458@rice.edu> (raw)
References: <372F5CEF.40A8B29@iserv.net>

Matt - 
We've been running into exactly the same problems you, for exactly the
same reason: we have a highly 'normalized' database design, in order to
easily populate drop-downs and picklists (get the users to enter the
right data by only giving them the right data!) You don't mention what
version of PostgreSQL you're using, but I bet it's 6.4.2. The
development team found some nasty problems in the query optimzer that
caused exactly these symptoms, and there are fixes in v6.5beta.  

The way to test if this is the problem is to try your query at the psql
prompt, then try an EXPLAIN of your query. IF the EXPLAIN takes a long
time (and a lot of memory), bingo!

One workaround until you can upgrade (the beta is shaking out bugs right
now) is to enable the Genetic Query Optimizer at a small number of
tables. This sort of short circuits the problem. Note that the WinODBC
driver disables GQO by default (if you're using that)

via SQL, do:
SET GEQO TO 'ON=5';

or some other small number: it's the number of tables in a 'join' at
which GEQO will take over.


HTH,
Ross

Matt Behrens wrote:
> 

<problem with large joins blowing up>

-- 
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu> 
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St.,  Houston, TX 77005



view thread (3+ messages)  latest in thread

Message-ID: <372F61B4.AC6BD458@rice.edu>
Permalink:  ../372F61B4.AC6BD458@rice.edu/
Also on:    postgresql.org/message-id/372F61B4.AC6BD458@rice.edu

 · 

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-sql@postgresql.org
  Cc: reedstrm@rice.edu
  Subject: Re: [SQL] Selecting with a large number of foreign keys
  In-Reply-To: <372F61B4.AC6BD458@rice.edu>
  References: <372F5CEF.40A8B29@iserv.net> <372F61B4.AC6BD458@rice.edu>

* 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