Re: View performance question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Josh Berkus" <josh(at)agliodbs(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: View performance question
Date: 2001-06-22 17:05:59
Message-ID: 4558.993229559@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Josh Berkus" <josh(at)agliodbs(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Ross J. Reedstrom 2001-06-22 17:18:16 Re: Incremental sum ?
Previous Message Bruce Momjian 2001-06-22 17:04:29 Re: firehouse