X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8074914B2800 for ; Tue, 10 Aug 2004 14:52:36 -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 38075-09 for ; Tue, 10 Aug 2004 17:52:25 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id B225E14B281F for ; Tue, 10 Aug 2004 14:52:19 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i7AHq6sk029795; Tue, 10 Aug 2004 13:52:07 -0400 (EDT) To: "Ole Streicher" Cc: pgsql-jdbc@postgresql.org Subject: Re: Cleaning up large objects In-reply-to: <4890.1092150780@www53.gmx.net> References: <4890.1092150780@www53.gmx.net> Comments: In-reply-to "Ole Streicher" message dated "Tue, 10 Aug 2004 17:13:00 +0200" Date: Tue, 10 Aug 2004 13:52:06 -0400 Message-ID: <29794.1092160326@sss.pgh.pa.us> From: Tom Lane 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/71 X-Sequence-Number: 10793 "Ole Streicher" writes: > What is wrong with my approach that it does not free the disk space? Plain vacuum is not designed to "free" disk space, at least not in the sense of returning it to the operating system. What it's designed to do is record free disk space within table files in the "free space map" (FSM) so that it can be re-used for future row creation. To aggressively compact table files and return space to the OS, you need vacuum full, which is a great deal slower and requires exclusive table locks. If you see space leakage in a database that should have a reasonably constant total size, the reason is usually that you don't have the FSM parameters set large enough to remember all the free space. Check your settings in postgresql.conf and increase if needed. (Note that an increase requires a postmaster restart to take effect.) You might also want to think about vacuuming more often than once a day, so that space can be recycled into the FSM sooner. When you have a periodic bulk delete process, it's not a bad idea to vacuum the table that had the deletes immediately after each deletion run. Depending on how far behind the eight-ball you are, you may need a pass of vacuum full to get the DB back down to a reasonable size. BTW, "cluster" can serve as a substitute for vacuum full, since it also compacts out dead space. It can be significantly faster than vacuum full when there's a lot of space to be reclaimed. regards, tom lane