X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BD0E9DA0A9 for ; Tue, 4 Oct 2005 18:01:38 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80279-03 for ; Tue, 4 Oct 2005 21:01:35 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) by svr1.postgresql.org (Postfix) with ESMTP id A8C71DA0B0 for ; Tue, 4 Oct 2005 18:01:36 -0300 (ADT) Received: by flake.decibel.org (Postfix, from userid 1001) id 14D091527C; Tue, 4 Oct 2005 16:01:38 -0500 (CDT) Date: Tue, 4 Oct 2005 16:01:37 -0500 From: "Jim C. Nasby" To: Richard Huxton Cc: xchris , pgsql-performance@postgresql.org Subject: Re: Lists or external TABLE? Message-ID: <20051004210137.GZ40138@pervasive.com> References: <1128071781.8112.32.camel@lyra> <433D06AB.3020409@archonet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <433D06AB.3020409@archonet.com> X-Operating-System: FreeBSD 4.11-RELEASE-p10 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 required=5 tests=[AWL=0.008] X-Spam-Level: X-Archive-Number: 200510/48 X-Sequence-Number: 14816 On Fri, Sep 30, 2005 at 10:34:35AM +0100, Richard Huxton wrote: > xchris wrote: > > > >Let's suppose i need to add an info about addresses (which includes > >country,city,cap....etc etc). > >Addresses can vary from 1 to 20 entries.. > > > >Talking about performance is it better to include a list of addresses in > >TABLE A or is it better to create an external TABLE B? > > Don't optimise before you have to. > > Do the addresses belong in "A"? If so, put them there. On the other > hand, if you want items in "A" to have more than one address, or to > share addresses then clearly you will want a separate address table. > It's difficult to say more without a clear example of your requirements. > > Even if you choose to alter your design for performance reasons, you > should make sure you run tests with realistic workloads and hardware. > But first, trust PG to do its job and design your database according to > the problem requirements. On top of what Richard said, 5000 rows is pretty tiny. Even if each row was 1K wide, that's still only 5MB. Also, if from a data-model standpoint it doesn't matter which way you go, I suggest looking at what it will take to write queries against both versions before deciding. I tend to stay away from arrays because they tend to be harder to query against. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461