X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 86040D1B48E for ; Thu, 29 Jul 2004 21:17:23 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33785-02 for ; Fri, 30 Jul 2004 00:17:24 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id BE951D1B483 for ; Thu, 29 Jul 2004 21:17:20 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i6U0HJqb042345 for ; Fri, 30 Jul 2004 00:17:19 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i6U0FNa9042226 for pgsql-admin@postgresql.org; Fri, 30 Jul 2004 00:15:23 GMT From: Steve X-Newsgroups: comp.databases.postgresql.admin Subject: Re: please please please PLEASE help! Date: Fri, 30 Jul 2004 10:14:19 +1000 Organization: Hub.Org Networking Services Lines: 32 Message-ID: References: <410914E1.3000808@musicrebellion.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 X-Accept-Language: en-us, en In-Reply-To: To: pgsql-admin@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/3 X-Sequence-Number: 14398 Rob Bamber wrote: > Another thought - > > We had a similar issue recently. Our support guys dropped the database and > then rebuilt it from a dump file. The size of the data directory went down > from 12GB to less than 2GB. According to the sys ad that did the work > postgres is not very good a reclaiming disk space after large quantities of > tuples are deleted over time. > > HTH > That's because you need to 'VACUUM [FULL | ANALYZE]' the database frequently. For example, in our case there are about 2000 updates/inserts and around 50 'deletes' every 3 minutes . 'Update' and 'delete' operations are most expensive (in terms of disk space utilization) as they tend to keep the updated/deleted tuples for a longer period of time, until VACUUM is run. I've set it up so that a daemon runs VACUUM ANALYZE every 6 minutes or so, and then a full vacuum, i.e. VACUUM FULL ANALYZE, every 30 mins. As far as I know, in postgresql 7.4, a simple VACUUM operation doesn't block read operations and so occassianlly running VACUUM on the most 'popular' tables would be a good idea. I'm sure in your case the frequency of calling vacuum could vary, but that is basically why the database reduced to 2GB from 12GB. VACUUM basically deletes unwanted tuples and indexes and so 'compresses' the amount of disk space used (and so effectively speeding up queries two to three orders of magnitude). Steve