Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id E74B49FCB78 for ; Thu, 8 Nov 2007 11:10:11 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 01344-01 for ; Thu, 8 Nov 2007 11:09:49 -0400 (AST) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.251]) by postgresql.org (Postfix) with ESMTP id 8AFE29FA15A for ; Thu, 8 Nov 2007 11:10:06 -0400 (AST) Received: by an-out-0708.google.com with SMTP id c10so23123ana for ; Thu, 08 Nov 2007 07:10:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; bh=qG4mZvzYc35xcllT7v4JQVbPFHJSihdlSpclICqxSjY=; b=NsBlmycHfRUJoyXsPheKEslPjgZlBMMDQrgHgBZZuXh4EiMe2BH32zAbrwjnJ5SgaNGvi1NtNMT/RKVqSJ3efkTiyUoFd0qbkYQ+QneH0Cna2Ijq+e/6YUmyLw/nRrmzinv+UKD0fgfprSgj0VeTIsryANkKQ1RI6+e8i7OEaP0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=qFuEzRC7/PLFTKa/ujOTUId9vjFozrj2GfVzjyUx1D6tgKkoF+Toz81sHhfc/winP9pYBjfUW+mIT9OYbvj9IZChyaMrb+zjWvq3UT1mRRGKLLG6RY0rq5ILRcpbUFSdUJCjhse+E/nisUu+ECbRdNAxCrOjFeBE+ZbJkBpFxUk= Received: by 10.100.211.8 with SMTP id j8mr932523ang.1194534604352; Thu, 08 Nov 2007 07:10:04 -0800 (PST) Received: from ?192.168.1.33? ( [82.13.25.139]) by mx.google.com with ESMTPS id d26sm517960nfh.2007.11.08.07.09.57 (version=SSLv3 cipher=RC4-MD5); Thu, 08 Nov 2007 07:10:01 -0800 (PST) Message-ID: <473326C3.3070206@enterprisedb.com> Date: Thu, 08 Nov 2007 15:09:55 +0000 From: Heikki Linnakangas User-Agent: Icedove 1.5.0.12 (X11/20070730) MIME-Version: 1.0 To: Rafael Martinez CC: pgsql-performance@postgresql.org Subject: Re: Need to run CLUSTER to keep performance References: <4732E6B4.1030907@usit.uio.no> <4732EF07.3060807@enterprisedb.com> <47332200.9050705@usit.uio.no> In-Reply-To: <47332200.9050705@usit.uio.no> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/99 X-Sequence-Number: 27514 Rafael Martinez wrote: > Heikki Linnakangas wrote: >> On a small table like that you could run VACUUM every few minutes >> without much impact on performance. That should keep the table size in >> check. > > Ok, we run VACUUM ANALYZE only one time a day, every night. But we would > espect the performance to get ok again after running vacuum, and it > doesn't. Only CLUSTER helps. If the table is already bloated, a VACUUM won't usually shrink it. It only makes the space available for reuse, but a sequential scan still needs to go through a lot of pages. CLUSTER on the other hand repacks the tuples and gets rid of all the unused space on pages. You need to run CLUSTER or VACUUM FULL once to shrink the relation, but after that frequent-enough VACUUMs should keep the table size down. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com