Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id E17481337D23 for ; Thu, 14 Oct 2010 06:11:01 -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 14521-03-5 for ; Thu, 14 Oct 2010 09:10:49 +0000 (UTC) Received: from mx3.hub.org (mx3.hub.org [206.223.169.73]) by mail.postgresql.org (Postfix) with ESMTP id F291E1337D30 for ; Wed, 13 Oct 2010 19:50:17 -0300 (ADT) X-Greylist: delayed 01:15:01.770075 by SQLgrey-1.7.6 Received: from mail.catalyst.net.nz (bertrand.catalyst.net.nz [202.78.240.40]) by mx3.hub.org (Postfix) with ESMTP id A04EF37B870 for ; Wed, 13 Oct 2010 19:50:18 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mail.catalyst.net.nz (Postfix) with ESMTP id 83CCF325E3 for ; Thu, 14 Oct 2010 10:48:22 +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 wlda6S5cM0jD for ; Thu, 14 Oct 2010 10:48:22 +1300 (NZDT) Received: from [IPv6:2404:130:0:1000:222:15ff:fe5c:2471] (unknown [IPv6:2404:130:0:1000:222:15ff:fe5c:2471]) (Authenticated sender: mark.kirkwood) by mail.catalyst.net.nz (Postfix) with ESMTPSA id E6891325D6 for ; Thu, 14 Oct 2010 10:48:21 +1300 (NZDT) Message-ID: <4CB62925.2070401@catalyst.net.nz> Date: Thu, 14 Oct 2010 10:48:21 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.12) Gecko/20100915 Lightning/1.0b1 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> <4CB2410C.6010603@postnewspapers.com.au> <201010102115.58729.neil.whelchel@gmail.com> <201010122347.20542.neil.whelchel@gmail.com> <4CB55D7E.8080902@catalyst.net.nz> <4CB57159.2090501@vmsinfo.com> In-Reply-To: <4CB57159.2090501@vmsinfo.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.001 tagged_above=-10 required=5 tests=BAYES_40=-0.001, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201010/225 X-Sequence-Number: 40643 On 13/10/10 21:44, Mladen Gogala wrote: > On 10/13/2010 3:19 AM, Mark Kirkwood wrote: >> I think that major effect you are seeing here is that the UPDATE has >> made the table twice as big on disk (even after VACUUM etc), and it has >> gone from fitting in ram to not fitting in ram - so cannot be >> effectively cached anymore. >> > In the real world, tables are larger than the available memory. I have > tables of several hundred gigabytes in size. Tables shouldn't be > "effectively cached", the next step would be to measure "buffer cache > hit ratio", tables should be effectively used. > Sorry Mladen, I didn't mean to suggest that all tables should fit into ram... but was pointing out (one reason) why Neil would expect to see a different sequential scan speed after the UPDATE. I agree that in many interesting cases, tables are bigger than ram [1]. Cheers Mark [1] Having said that, these days 64GB of ram is not unusual for a server... and we have many real customer databases smaller than this where I work.