Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 46F692E0045 for ; Mon, 25 Feb 2008 03:01:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 42934-09 for ; Mon, 25 Feb 2008 03:01:49 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from cat.co.za (mailer.cat.co.za [196.34.125.51]) by postgresql.org (Postfix) with SMTP id 281D12E0039 for ; Mon, 25 Feb 2008 03:01:46 -0400 (AST) Received: (qmail 21051 invoked by uid 1002); 25 Feb 2008 07:11:02 -0000 Received: from stuartb@cat.co.za by mail.cat.co.za by uid 807 with qmail-scanner-1.21 (clamscan: 0.70. Clear:RC:1(196.34.125.52):. Processed in 3.549887 secs); 25 Feb 2008 07:11:02 -0000 Received: from unknown (HELO ?192.168.34.201?) (196.34.125.52) by 0 with SMTP; 25 Feb 2008 07:10:57 -0000 Message-ID: <47C266C9.4060209@cat.co.za> Date: Mon, 25 Feb 2008 08:57:13 +0200 From: Stuart Brooks User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: autovacuum not freeing up unused space on 8.3.0 References: <47C25FC5.5090507@cat.co.za> In-Reply-To: <47C25FC5.5090507@cat.co.za> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.136 tagged_above=0 required=5 tests=AWL=0.136 X-Spam-Level: X-Archive-Number: 200802/178 X-Sequence-Number: 30269 It seems like pgsql-general would be the right list for this so I am going to post it there rather, sorry for the noise... > It appears (and I am open to correction) that autovacuum is not > operating correctly in 8.3.0. I have a vanilla installation where > autovacuum is enabled, and is running with all the default settings. > > I have a table which is continually having rows added to it (~50/sec). > For the sake of this example I am limiting it to 20000 rows, which > means that I am continually having to remove rows (100 at a time) as I > get to 20000. > > When I get to 20000 rows for the first time the table disk size (using > pg_total_relation_size) is around 5MB. Since the autovacuum only kicks > in after a while I would expect it to get a little bigger (maybe > 6-7MB) and then level out as I am cycling through recovered rows. > > However the table disk size continues increasing basically linearly > and when I stopped it it was approaching 40MB and heading up. During > that time I was running ANALYZE VERBOSE periodically and I could see > the dead rows increase and then drop down as the autovacuum kicked in > - the autovacuum worker process was running. It didn't seem to free > any space though. In fact a VACUUM FULL at this point didn't help a > whole lot either. > > I ran the same test but using manual VACUUMs every 60 seconds and the > table size leveled out at 6.6MB so it appears like a normal vacuum is > working. I changed the normal VACUUM to have the same delay parameters > (20ms) as the autovacuum and it still worked. > > So it appears to me like the autovacuum is not freeing up dead rows > correctly. > > I turned on logging for autovacuum and ran the same test and saw the > following messages: > > LOG: automatic vacuum of table "metadb.test.transactions": index > scans: 1 > pages: 0 removed, 254 remain > tuples: 4082 removed, 19957 remain > system usage: CPU 0.02s/0.02u sec elapsed 1.11 sec > LOG: automatic vacuum of table "metadb.test.transactions": index > scans: 1 > pages: 0 removed, 271 remain > tuples: 5045 removed, 19954 remain > system usage: CPU 0.03s/0.03u sec elapsed 1.54 sec > ERROR: canceling autovacuum task > CONTEXT: automatic vacuum of table "metadb.test.transactions" > > At this point I had deleted 32800 rows as can be seen from the query > below, although the logs only indicated that around 10000 rows had > been freed up. > > select min(transaction_key),max(transaction_key) from test.transactions; > min | max > -------+------- > 32801 | 52750 > > > Is there anything I have missed as far as setting this up is > concerned, anything I could try? I would really rather use autovacuum > than manage the vacuums of a whole lot of tables by hand... > > Thanks > Stuart > > PS. Running on NetBSD 3 > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > >