Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 04DB29F9BF0 for ; Mon, 24 Sep 2007 11:31:32 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 23213-09 for ; Mon, 24 Sep 2007 11:31:21 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from mail01.enterprisedb.com (mail01.enterprisedb.com [63.246.7.168]) by postgresql.org (Postfix) with ESMTP id 0F1199F96A2 for ; Mon, 24 Sep 2007 11:31:26 -0300 (ADT) thread-index: Acf+t5+x4AfG6lAnT7OxGPLO6tdV7g== Received: from [172.24.32.189] ([62.232.55.118]) by mail01.enterprisedb.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Mon, 24 Sep 2007 10:31:41 -0400 Content-Class: urn:content-classes:message Importance: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4073 Message-ID: <46F7C9F1.1080805@enterprisedb.com> Date: Mon, 24 Sep 2007 15:30:09 +0100 From: "Heikki Linnakangas" User-Agent: Icedove 1.5.0.12 (X11/20070730) MIME-Version: 1.0 To: =?iso-8859-1?Q?G=E1bor_Farkas?= Cc: Subject: Re: select count(*) performance (vacuum did not help) References: <46F7C494.1050604@nekomancer.net> In-Reply-To: <46F7C494.1050604@nekomancer.net> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-OriginalArrivalTime: 24 Sep 2007 14:31:41.0375 (UTC) FILETIME=[9F9DFCF0:01C7FEB7] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/419 X-Sequence-Number: 26964 Gábor Farkas wrote: > - this table has a lot of updates and inserts, it works very similarly > to a session-table for a web-application Make sure you run VACUUM often enough. > - there is a cron-job that deletes all the old entries, so it's size is > rougly between 15000 and 35000 entries (it's run daily, and every day > deletes around 10000 entries) Running vacuum after these deletes to immediately reclaim the dead space would also be a good idea. > - but in the past, the cron-job was not in place, so the table's size > grew to around 800000 entries (in around 80 days) That bloated your table, so that there's still a lot of empty pages in it. VACUUM FULL should bring it back to a reasonable size. Regular normal non-FULL VACUUMs should keep it in shape after that. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com