X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id E3431D1B545 for ; Thu, 2 Oct 2003 21:09:40 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 77004-08 for ; Thu, 2 Oct 2003 18:08:52 -0300 (ADT) Received: from localhost.localdomain (unknown [65.217.53.66]) by svr1.postgresql.org (Postfix) with ESMTP id A10C7D1B503 for ; Thu, 2 Oct 2003 18:08:50 -0300 (ADT) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id h92K3jqd005729; Thu, 2 Oct 2003 16:03:45 -0400 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [192.168.3.55]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id h92L8iZ16630; Thu, 2 Oct 2003 17:08:44 -0400 Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id TD8AV2L7; Thu, 2 Oct 2003 17:08:42 -0400 Subject: Re: Question about DB VACUUM From: Robert Treat To: cjwhite@cisco.com Cc: pgsql-admin@postgresql.org In-Reply-To: <000b01c38914$7e11c1b0$5c976b80@amer.cisco.com> References: <000b01c38914$7e11c1b0$5c976b80@amer.cisco.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 02 Oct 2003 17:08:43 -0400 Message-Id: <1065128923.24250.21.camel@camel> Mime-Version: 1.0 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/29 X-Sequence-Number: 10590 As a starting point, check your free space map settings in the postgresql.conf. They are low by default in 7.2.x. free_space_relations* can safely be bumped to 1000. free_space_pages* should probably be bumped to something like 50000, though you might be able to determine a better amount be seeing how many pages are used up after each add/delete/vacuum cycle. One other thing to check on is if you have an indexes involved in the process, you may get some index growth issues that will require periodic indexing. HTH, Robert Treat * I'm pretty sure those aren't the exact names, but their similar so you should be able to find them. On Thu, 2003-10-02 at 14:39, Chris White (cjwhite) wrote: > Hi, > > I am using a Postgres 7.2.1 db to store binary data as large objects > which users can add or delete as they need. I have found that without > frequent vacuums of the database the disk space used by the database > grows very quickly, as users on average add and delete binary objects of > about 160K at a time. So I was trying to determine how often I should do > a vacuum in order to keep the database from growing too quickly. So I > ran a test where I did a full vacuum of the database to compact the > tables, then I added and deleted 12 large objects of 80K each and then > did a vacuum, not a full vacuum. I did this add/delete/vacuum process 4 > times in a row. I thought that by adding and deleting the same objects > and then vacuuming, the database shouldn't grow, as the new inserts > would reuse the space taken up by the deleted objects after the vacuum. > However, I was seeing the database grow each time. Here are the disk > usage values after each step: > > After initial vacuum full: > bash-2.05b# du -b -s /data/sql > 56664064 /data/sql > > After first add/delete/vacuum: > bash-2.05b# du -b -s /data/sql > 56987648 /data/sql > > 323584 byte increase > > After second add/delete/vacuum: > bash-2.05b# du -b -s /data/sql > 57012224 /data/sql > > 24576 byte increase > > After third add/delete/vacuum: > bash-2.05b# du -b -s /data/sql > 57061376 /data/sql > > 49152 byte increase > > After fourth add/delete/vacuum: > bash-2.05b# du -b -s /data/sql > 57085952 /data/sql > > 24576 byte increase > > Is this expected behavior? As at some point in time, if I carry on > repeating this test, I would have to do a vacuum full to retrieve disk > space, even though the actual contents of the database has not increased > from the initial starting point. > > Chris White -- Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL