Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5MH67a84681 for ; Fri, 22 Jun 2001 13:06:07 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id f5MH5x304561; Fri, 22 Jun 2001 13:05:59 -0400 (EDT) To: "Josh Berkus" cc: pgsql-sql@postgresql.org Subject: Re: View performance question In-reply-to: References: Comments: In-reply-to "Josh Berkus" message dated "Fri, 22 Jun 2001 08:07:40 -0700" Date: Fri, 22 Jun 2001 13:05:59 -0400 Message-ID: <4558.993229559@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200106/382 X-Sequence-Number: 3674 "Josh Berkus" 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