X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 6402111F6067 for ; Fri, 28 Apr 2006 14:31:44 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 60919-10 for ; Fri, 28 Apr 2006 14:31:35 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from hotmail.com (bay101-f18.bay101.hotmail.com [64.4.56.28]) by postgresql.org (Postfix) with ESMTP id 8E5C111F60A6 for ; Fri, 28 Apr 2006 14:31:34 -0300 (ADT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Fri, 28 Apr 2006 10:31:35 -0700 Message-ID: Received: from 64.4.56.200 by by101fd.bay101.hotmail.msn.com with HTTP; Fri, 28 Apr 2006 17:31:30 GMT X-Originating-IP: [84.210.10.106] X-Originating-Email: [bealach_na_bo@hotmail.com] X-Sender: bealach_na_bo@hotmail.com In-Reply-To: <200604280802.59696@hal.medialogik.com> From: "Bealach-na Bo" To: pgsql-performance@postgresql.org Subject: Re: Why so slow? Date: Fri, 28 Apr 2006 17:31:30 +0000 Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-OriginalArrivalTime: 28 Apr 2006 17:31:35.0703 (UTC) FILETIME=[99363A70:01C66AE9] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200604/677 X-Sequence-Number: 18761 > > INFO: index "job_log_id_pkey" now contains 10496152 row versions in > > 59665 pages > >See the 10496152 above? That means you have 10496152 rows of data in your >table. If those, only 365000 are alive. That means you have basically >never vacuumed this table before, correct? Almost correct :| I have vacuumed this table monthly (obviously not nearly enough), but it is basically a log of events of which there are a very large number of each day. > >Every update or delete creates a new dead row. count(*) scans the whole >table, dead rows included. That's why it takes so long, the table acts as >though it has 10496152 rows when doing sequential scans. Oh! This explains my problems. > >Do a VACCUM FULL on it or CLUSTER it on on a index, both of which will >empty >out all the free space and make it behave as it should. Note; VACUUM FULL >will take quite a while and requires an exclusive lock on the table. >CLUSTER also requires an exclusive lock but should be a lot faster for this >table. > >Oh, and get autovacuum setup and working, posthaste. The exclusive lock is going to cause problems for me since the table is very active. Is there a way of getting around that or do I need to schedule the application that accesses this table? I'm running version 8.0. Is there autovacuum for this version too? Regards, Bealach