Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 48A7F632B2E for ; Fri, 13 Feb 2009 18:40:09 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 39969-04 for ; Fri, 13 Feb 2009 18:40:05 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-gx0-f224.google.com (mail-gx0-f224.google.com [209.85.217.224]) by mail.postgresql.org (Postfix) with ESMTP id 95362632878 for ; Fri, 13 Feb 2009 18:40:05 -0400 (AST) Received: by gxk24 with SMTP id 24so1483978gxk.19 for ; Fri, 13 Feb 2009 14:40:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=b991/XkL3Hwv1boOC3ITzhyKOgGyerRIDtqQt78ARtc=; b=HCCdPlEcLDEWlKbu5j3WObnWKP+a2NC2yIHUDe0C1CVjv0u0lN97NuMoPae1iJOgh3 0SvaUImLkDaZLQCzFZaBwsD7PcFJe/cE7eGXju17QsFl9/zgFzDnTzcl+4j4agVRRIlw avRekplpr4T1GrAwBxIwlkWXyiXSJ9iL71UIY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=MNRJFbKuS7S0sTJY51ga3cLUFdWyBwt8K292SxPR2Ns5cfHjpS3yYm+nU4XwEixANd x2py3Vniw0cKpDxmvlVtLDPWuIPZ+HBAE925gritaIRsw/Rnavx8EFG9fa8y4byGQxAq aNygNY1D9py3wVeJmCAOLyeEwAG4RTJld380E= MIME-Version: 1.0 Received: by 10.151.114.6 with SMTP id r6mr2166361ybm.0.1234564804416; Fri, 13 Feb 2009 14:40:04 -0800 (PST) In-Reply-To: <20090213223453.GH12562@easy2.in-chemnitz.de> References: <4995ABC0.4090401@musicreports.com> <4995EC90.5020200@musicreports.com> <20090213223453.GH12562@easy2.in-chemnitz.de> Date: Fri, 13 Feb 2009 15:40:04 -0700 Message-ID: Subject: Re: Vacuum wait time problem From: Scott Marlowe To: Tino Schwarze Cc: pgsql-admin@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200902/94 X-Sequence-Number: 31315 On Fri, Feb 13, 2009 at 3:34 PM, Tino Schwarze wrote: > On Fri, Feb 13, 2009 at 03:13:28PM -0700, Scott Marlowe wrote: > > [...] > >> Yeah, that's pretty bad. ~2 Million live rows and ~18 Million dead >> ones is a pretty badly bloated table. >> >> Vacuum full is one way to reclaim that lost space. You can also dump >> and restore that one table, inside a drop / create restraints in a >> transaction during maintenance if you can. A Vacuum full is quite >> intrusive, so avoid it during normal working hours. Dumping and >> reloading the whole db may be faster than either a vacuum full or a >> cluster. A common trick is to do something like: >> >> begin; >> select * into ordermydata from bigbloatedtable order by some_field; >> delete * from bigbloatedtable; >> insert into bigbloatedtable select * from ordermydata; >> commit; >> >> This will both put your table in some order which might help, and >> remove the bloat. > > Really? Wouldn't that add even more bloat? How does that work? (I'd > expect a drop table/create table instead of the delete...) > Note: I suppose that you know a lot more about PG than I do, so I'm just > curious. Whoops, meant truncate bigbloatedtable; sheesh, long week.