Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 26524632599 for ; Fri, 25 Jun 2010 20:37:33 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 56195-06 for ; Fri, 25 Jun 2010 23:37:23 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pv0-f174.google.com (mail-pv0-f174.google.com [74.125.83.174]) by mail.postgresql.org (Postfix) with ESMTP id C8CF7632445 for ; Fri, 25 Jun 2010 20:37:24 -0300 (ADT) Received: by pvg2 with SMTP id 2so1080995pvg.19 for ; Fri, 25 Jun 2010 16:37:23 -0700 (PDT) Received: by 10.143.21.34 with SMTP id y34mr1856601wfi.85.1277508657986; Fri, 25 Jun 2010 16:30:57 -0700 (PDT) Received: from Craig-Jamess-MacBook-Pro.local (wsip-70-167-124-126.sd.sd.cox.net [70.167.124.126]) by mx.google.com with ESMTPS id g14sm750406rvb.18.2010.06.25.16.30.56 (version=SSLv3 cipher=RC4-MD5); Fri, 25 Jun 2010 16:30:57 -0700 (PDT) Message-ID: <4C253C2F.7080001@emolecules.com> Date: Fri, 25 Jun 2010 16:30:55 -0700 From: Craig James User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.10) Gecko/20100512 Thunderbird/3.0.5 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Architecting a database References: <4C24E5E90200002500032B5A@gw.wicourts.gov> <4C24E7570200002500032B5D@gw.wicourts.gov> <4C24E7570200002500032B5D@gw.wicourts.gov> In-Reply-To: <4C24E7570200002500032B5D@gw.wicourts.gov> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.115 tagged_above=-10 required=5 tests=BAYES_50=0.8, RCVD_IN_DNSWL_NONE=-0.0001, SARE_MILLIONSOF=0.315 X-Spam-Level: * X-Archive-Number: 201006/486 X-Sequence-Number: 39342 On 6/25/10 3:28 PM, Kevin Grittner wrote: > wrote: >> With the PostgreSQL type tables I am not so certain how the data >> is arranged within the one file. Does having the data all in one >> database allow PostgreSQL to better utilize indexes and caches or >> does having a number of smaller databases provide performance >> increases? In case it is important, there are 2000 clients >> involved, so that would be 2000 databases if I followed my current >> FoxPro related structure. > > The implications of putting multiple clients in a table, with a > client's rows identified by a client_id column, are probably fairly > obvious. If many of those 2,000 clients have tables with millions of > rows, performance could suffer without very careful indexing, > managing tables with billions of rows can become challenging, and > there could be concerns about how to ensure that data from one > client isn't accidentally shown to another. You should also ask whether there are social (that is, nontechncal) reasons to avoid multiple clients per table. When a customer asks about security and you tell them, "You get your own database, nobody else can log in," they tend to like that. If you tell them that their data is mixed with everyone else's, but "we've done a really good job with our app software and we're pretty sure there are no bugs that would let anyone see your data," that may not fly. People will trust Postgres security (assuming you actually do it right) because it's an open source, trusted product used by some really big companies. But your own app? Do you even trust it? Even if your application IS secure, it may not matter. It's what the customer believes or worries about that can sell your product. We've also found another really good reason for separate databases. It lets you experiment without any impact on anything else. We have scripts that can create a database in just a few minutes, load it up, and have it ready to demo in just a few minutes. If we don't end up using it, we just blow it off and its gone. No other database is impacted at all. Craig