X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id B0EBAD1C4E6 for ; Fri, 1 Aug 2003 17:45:34 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 57500-10 for ; Fri, 1 Aug 2003 14:44:26 -0300 (ADT) Received: from davinci.ethosmedia.com (209-128-84-228.bayarea.net [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 9EDC7D1C4BF for ; Fri, 1 Aug 2003 14:45:32 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3368147; Fri, 01 Aug 2003 10:45:53 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: Francisco J Reyes , Ron Johnson Subject: Re: How number of columns affects performance Date: Fri, 1 Aug 2003 10:44:03 -0700 User-Agent: KMail/1.4.3 Cc: PostgreSQL performance References: <20030801115257.I92555@zoraida.natserv.net> <1059755687.7508.638.camel@haggis> <20030801130507.M93127@zoraida.natserv.net> In-Reply-To: <20030801130507.M93127@zoraida.natserv.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200308011044.03493.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/11 X-Sequence-Number: 2828 Francisco, > Yes all fields belong to the same entity. I used 100 as an example it may > be something like 60 to 80 fields (there are two tables in question). I > don't formally do 3rd normal form, but for the most part I do most of > the general concepts of normalization. > > > If not, then good design says to split the table. Actually, no, it doesn't. If all 60-80 fields are unitary and required characteristics of the row-entity, normalization says keep them in one table. The only time NF would recommend splitting the table is for fields which are frequenly NULL for reasons other than missing data entry. For those, you'd create a child table. Although while this is good 4NF, it's impractical in PostgreSQL, where queries with several LEFT OUTER JOINs tend to be very slow indeed. My attitude toward these normalization vs. performance issues is consistenly the same: First, verify that you have a problem. That is, build the database with everything in one table (or with child tables for Nullable fields, as above) and try to run your application. If performance is appalling, *then* take denormalization steps to improve it. I'm frequently distressed by the number of developers who make questionable design decisions "for performance reasons" without every verifying that they were, in fact, improving performance ... -- Josh Berkus Aglio Database Solutions San Francisco