pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Josh Berkus <josh@agliodbs.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: View performance question
Date: Fri, 22 Jun 2001 13:05:59 -0400
Message-ID: <4558.993229559@sss.pgh.pa.us> (raw)
In-Reply-To: <web-75902@davinci.ethosmedia.com>
References: <web-75902@davinci.ethosmedia.com>

"Josh Berkus" <josh@agliodbs.com> writes:
> I created a view to support comprehensive reporting on one of the
> databases I work with.  Unfortunately, due to the structure of the
> database, which includes 25 reference tables, this requires 3 regular
> joins and about 40 LEFT OUTER JOINS, outputting about 100 columns.

I suppose this is a star schema, wherein rows of the main tables join
to at most one row of the "reference" tables?  If so, you probably want
to make sure you perform the join of the main tables before you start
outerjoining the reference tables onto them.  The syntax you are using
is constraining the planner to use what's probably not a good plan.
See
http://www.ca.postgresql.org/users-lounge/docs/7.1/postgres/explicit-joins.html

			regards, tom lane



view thread (8+ messages)  latest in thread

Message-ID: <4558.993229559@sss.pgh.pa.us>
Permalink:  ../4558.993229559@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4558.993229559@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, josh@agliodbs.com
  Subject: Re: View performance question
  In-Reply-To: <4558.993229559@sss.pgh.pa.us>

* 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