Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 775201337B54 for ; Wed, 13 Oct 2010 05:50:35 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 50349-10 for ; Wed, 13 Oct 2010 08:50:28 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.catalyst.net.nz (bertrand.catalyst.net.nz [202.78.240.40]) by mail.postgresql.org (Postfix) with ESMTP id 0C64D1337BC5 for ; Wed, 13 Oct 2010 05:50:27 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mail.catalyst.net.nz (Postfix) with ESMTP id AC515321D1 for ; Wed, 13 Oct 2010 21:50:25 +1300 (NZDT) X-Virus-Scanned: Debian amavisd-new at catalyst.net.nz Received: from mail.catalyst.net.nz ([127.0.0.1]) by localhost (bertrand.catalyst.net.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id N1DpDn1HN+3C for ; Wed, 13 Oct 2010 21:50:25 +1300 (NZDT) Received: from [192.168.1.11] (122-58-208-29.jetstream.xtra.co.nz [122.58.208.29]) (Authenticated sender: mark.kirkwood) by mail.catalyst.net.nz (Postfix) with ESMTPSA id 09B433254F for ; Wed, 13 Oct 2010 21:50:24 +1300 (NZDT) Message-ID: <4CB572CF.4080709@catalyst.net.nz> Date: Wed, 13 Oct 2010 21:50:23 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Slow count(*) again... References: <201010091626.18636.neil.whelchel@gmail.com> <201010122347.20542.neil.whelchel@gmail.com> <4CB55D7E.8080902@catalyst.net.nz> <201010130138.39893.neil.whelchel@gmail.com> In-Reply-To: <201010130138.39893.neil.whelchel@gmail.com> 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=-0.011 tagged_above=-10 required=5 tests=BAYES_20=-0.001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201010/201 X-Sequence-Number: 40620 On 13/10/10 21:38, Neil Whelchel wrote: > > So with our conclusion pile so far we can deduce that if we were to keep all > of our data in two column tables (one to link them together, and the other to > store one column of data), we stand a much better chance of making the entire > table to be counted fit in RAM, so we simply apply the WHERE clause to a > specific table as opposed to a column within a wider table... This seems to > defeat the entire goal of the relational database... > > That is a bit excessive I think - a more reasonable conclusion to draw is that tables bigger than ram will drop to IO max speed to scan, rather than DIMM max speed... There are things you can do to radically improve IO throughput - e.g a pair of AMC or ARECA 12 slot RAID cards setup RAID 10 and tuned properly should give you a max sequential throughput of something like 12*100 MB/s = 1.2 GB/s. So your example table (estimated at 2GB) so be able to be counted by Postgres in about 3-4 seconds... This assumes a more capable machine than you are testing on I suspect. Cheers Mark