Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id EDEA39FB69F for ; Tue, 5 Jun 2007 16:34:13 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 28155-02 for ; Tue, 5 Jun 2007 16:34:07 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 8C2DB9FB662 for ; Tue, 5 Jun 2007 16:34:09 -0300 (ADT) Received: from [10.10.1.37] ([10.10.1.37]) by exchange.g2switchworks.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 5 Jun 2007 14:34:08 -0500 Message-ID: <4665BAB0.2020605@g2switchworks.com> Date: Tue, 05 Jun 2007 14:34:08 -0500 From: Scott Marlowe User-Agent: Thunderbird 1.5.0.4 (X11/20060516) MIME-Version: 1.0 To: Gregory Stark CC: david@lang.hm, Thomas Andrews , Mark Lewis , pgsql-performance@postgresql.org Subject: Re: Thousands of tables versus on table? References: <1180980943.31471.322.camel@archimedes> <46645DD9.7030805@soliantconsulting.com> <877iqjmro5.fsf@oxford.xeocode.com> <46647427.4030103@g2switchworks.com> <466593E5.1010904@g2switchworks.com> <87sl96z0wf.fsf@oxford.xeocode.com> In-Reply-To: <87sl96z0wf.fsf@oxford.xeocode.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 05 Jun 2007 19:34:08.0712 (UTC) FILETIME=[7C6B9C80:01C7A7A8] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/76 X-Sequence-Number: 25109 Gregory Stark wrote: > "Scott Marlowe" writes: > > >> Sorry, I think I initially read your response as "Postgres doesn't really get >> any faster by breaking the tables up" without the "like that" part. >> > > Well breaking up the tables like that or partitioning, either way should be > about equivalent really. Breaking up the tables and doing it in the > application should perform even better but it does make the schema less > flexible and harder to do non-partition based queries and so on. > True, but we can break it up by something other than the company name on the survey, in this instance, and might find it far easier to manage by, say, date range, company ID range, etc... Plus with a few hand rolled bash or perl scripts we can maintain our database and keep all the logic of partitioning out of our app. Which would allow developers not wholly conversant in our partitioning scheme to participate in development without the fear of them putting data in the wrong place. > Where the win in partitioning comes in is in being able to disappear some of > the data entirely. By making part of the index key implicit in the choice of > partition you get away with a key that's half as large. And in some cases you > can get away with using a different key entirely which wouldn't otherwise have > been feasible to index. In some cases you can even do sequential scans whereas > in an unpartitioned table you would have to use an index (or scan the entire > table). > Yeah, I found that out recently while I benchmarking a 12,000,000 row geometric data set. Breaking it into 400 or so partitions resulted in no need for indexes and response times of 0.2 or so seconds, where before that I'd been in the 1.5 to 3 second range.