Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 20DCD1337BE3 for ; Fri, 25 Mar 2011 16:26:55 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 25491-07 for ; Fri, 25 Mar 2011 19:26:45 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from spinlock.commandprompt.com (host-215.commandprompt.net [207.173.203.215]) by mail.postgresql.org (Postfix) with ESMTP id 729531337BE2 for ; Fri, 25 Mar 2011 16:26:44 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by spinlock.commandprompt.com (Postfix) with ESMTP id 218EB348024; Fri, 25 Mar 2011 12:26:38 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at commandprompt.com Received: from spinlock.commandprompt.com ([127.0.0.1]) by localhost (spinlock.commandprompt.com.commandprompt.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jHEzNAwXQGf9; Fri, 25 Mar 2011 12:26:36 -0700 (PDT) Received: from perhan.alvh.no-ip.org (unknown [190.95.20.220]) by spinlock.commandprompt.com (Postfix) with ESMTPSA id BA255348022; Fri, 25 Mar 2011 12:26:35 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 401146EA88; Fri, 25 Mar 2011 16:26:33 -0300 (CLST) Content-Type: text/plain; charset=UTF-8 Cc: Christopher Browne , Maxim Boguk , pgsql-bugs Subject: Re: BUG #5946: Long exclusive lock taken by vacuum (not full) From: Alvaro Herrera To: Tom Lane In-reply-to: <13556.1301069421@sss.pgh.pa.us> References: <201103250856.p2P8ufGc004544@wwwmaster.postgresql.org> <4345.1301066239@sss.pgh.pa.us> <13556.1301069421@sss.pgh.pa.us> Date: Fri, 25 Mar 2011 16:26:33 -0300 Message-Id: <1301080686-sup-7539@alvh.no-ip.org> User-Agent: Sup/git Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201103/338 X-Sequence-Number: 29848 Excerpts from Tom Lane's message of vie mar 25 13:10:21 -0300 2011: > Christopher Browne writes: > > If there's almost always something that wants to access the table, > > which would be hardly surprising, in view that the table is being > > updated with sufficient regularity that it's got 10GB+ of dead space > > at the end, then you're eventually going to *HAVE* to vacuum it. > > Transaction rollover, and what not. > > It is already vacuumed. The only remaining step is to release free > space back to the OS; and if he's got a lot of churn in the table, > it's not entirely clear that that's a productive activity anyway. Right: future new tuples could need to extend the table, which would turn out not to be necessary because these pages at the end of the table are there and registered on the FSM. Truncating the table could turn out to be conterproductive because you would allocate a new block shortly, causing FS fragmentation. What happened to the idea of preallocating tables to a size defined by the user at CREATE TABLE time, and extending it in chunks instead of a block at a time, with the idea of reducing fragmentation? Was it rejected, or just not implemented? The other possibly useful idea was to let this truncate step to be run as a separate activity, without having to complete a vacuum cycle on the table. -- Álvaro Herrera The PostgreSQL Company - Command Prompt, Inc. PostgreSQL Replication, Consulting, Custom Development, 24x7 support