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 A52A2D1C50C for ; Fri, 1 Aug 2003 16:34:53 +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 55583-06 for ; Fri, 1 Aug 2003 13:33:45 -0300 (ADT) Received: from lakemtao03.cox.net (lakemtao03.cox.net [68.1.17.242]) by svr1.postgresql.org (Postfix) with ESMTP id B1CDAD1C4E6 for ; Fri, 1 Aug 2003 13:34:51 -0300 (ADT) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao03.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20030801163449.FJUT23518.lakemtao03.cox.net@[192.168.1.1]> for ; Fri, 1 Aug 2003 12:34:49 -0400 Subject: Re: How number of columns affects performance From: Ron Johnson To: PostgreSQL performance In-Reply-To: <20030801115257.I92555@zoraida.natserv.net> References: <20030801115257.I92555@zoraida.natserv.net> Content-Type: text/plain Message-Id: <1059755687.7508.638.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 01 Aug 2003 11:34:48 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/7 X-Sequence-Number: 2824 On Fri, 2003-08-01 at 11:08, Francisco Reyes wrote: > If a table which will be heavily used has numerous fields, yet only a > handfull of them will be used heavily, would it make sense performance wise to split it? > > Example > Table 1 > Field 1 > .... > Field 100 > > Table 2 > References Field 1 of table1 > ..... > > Table n > References Field 1 of table 1 > > So table 1 basically will be referenced by many tables and most of the > time only a handfull of fields of table 1 are needed. Don't have exact > numbers, but let's say that more than 60% of queries to table 1 queries > only use 20 fields or less. > > If I split Table 1 then the second table will basically be a 1 to 1 to > Table 1. Do all 100 fields *really* all refer to the same *one* entity, with no repeating values, etc? If not, then good design says to split the table. Also, if it's a high-activity table, but you only rarely need fields 60-90, then splitting them out to their own table might be useful (especially if some of those fields are large *CHAR or TEXT). > I have this simmilar scenario for two tables. One is close to 1 Million > records and the other is about 300,000 records. > > Programming wise it is much easier to only have one table, but I am just > concerned about performance. > > Most access to these tables will be indexed with some occassional > sequential scans. Number of concurrent users now is probably 10 or less. > Expect to grow to 20+ concurrent connections. Will this be more of an > issue if I had hundreds/thousands of users? > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) -- +-----------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | | Jefferson, LA USA | | | | "I'm not a vegetarian because I love animals, I'm a vegetarian | | because I hate vegetables!" | | unknown | +-----------------------------------------------------------------+