Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 1DC5B1337BB0 for ; Wed, 13 Oct 2010 04:19:41 -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 78423-03 for ; Wed, 13 Oct 2010 07:19:34 +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 C84701337B50 for ; Wed, 13 Oct 2010 04:19:33 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mail.catalyst.net.nz (Postfix) with ESMTP id 7A8B13251C for ; Wed, 13 Oct 2010 20:19:28 +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 P2bK6O-EuQgG for ; Wed, 13 Oct 2010 20:19:28 +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 C6F00322F8 for ; Wed, 13 Oct 2010 20:19:27 +1300 (NZDT) Message-ID: <4CB55D7E.8080902@catalyst.net.nz> Date: Wed, 13 Oct 2010 20:19:26 +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> <4CB2410C.6010603@postnewspapers.com.au> <201010102115.58729.neil.whelchel@gmail.com> <201010122347.20542.neil.whelchel@gmail.com> In-Reply-To: <201010122347.20542.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/194 X-Sequence-Number: 40613 On 13/10/10 19:47, Neil Whelchel wrote: > > Nope... > So, possible conclusions are: > 1. Even with VACUUM database table speed degrades as tables are updated. > 2. Time testing on a freshly INSERTed table gives results that are not real- > world. > 3. Filesystem defragmentation helps (some). > 4. Cache only makes a small difference once a table has been UPDATEd. > > I am going to leave this configuration running for the next day or so. This > way I can try any suggestions and play with any more ideas that I have. > I will try these same tests on ext4 later, along with any good suggested > tests. > I will try MySQL with the dame data with both XFS and ext4. > -Neil- > > 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. This would not normally happen in real life (assuming UPDATEs only modify a small part of a table per transaction). However administration updates (e.g 'oh! - ref 1 should now be ref 2 please update everything') *will* cause the table size to double. This is an artifact of Postgres's non overwriting storage manager - Mysql will update in place and you will not see this. Try VACUUM FULL on the table and retest. regards Mark