X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E567011F602E for ; Sun, 9 Apr 2006 15:38:02 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: 1.447 X-Spam-Level: * X-Spam-Status: No, score=1.447 required=5 tests=[AWL=-0.472, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44] Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 5bG9RkDhP-AA for ; Sun, 9 Apr 2006 15:37:55 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx1.surnet.cl (mx1.surnet.cl [216.155.73.180]) by postgresql.org (Postfix) with ESMTP id 945B511F602A for ; Sun, 9 Apr 2006 15:37:56 -0300 (ADT) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx1.surnet.cl with ESMTP; 09 Apr 2006 14:37:48 -0400 X-IronPort-AV: i="4.04,104,1144036800"; d="scan'208"; a="52379570:sNHT20020152" Received: from alvh.no-ip.org (201.221.200.14) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 43A978FD00E08DFD; Sun, 9 Apr 2006 14:37:48 -0400 Received: by alvh.no-ip.org (Postfix, from userid 1000) id DEAF8C2DC22; Sun, 9 Apr 2006 14:37:47 -0400 (CLT) Date: Sun, 9 Apr 2006 14:37:47 -0400 From: Alvaro Herrera To: Tomas Vondra Cc: pgsql-performance@postgresql.org Subject: Re: serious problems with vacuuming databases Message-ID: <20060409183747.GB15094@surnet.cl> Mail-Followup-To: Tomas Vondra , pgsql-performance@postgresql.org References: <443950FB.4050707@fuzzy.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <443950FB.4050707@fuzzy.cz> User-Agent: Mutt/1.5.11+cvs20060330 X-Archive-Number: 200604/178 X-Sequence-Number: 18262 Tomas Vondra wrote: Hi, > Then > these data were deleted from A, C, D and tables A_old, C_old and D_old > were dumped, truncated and all the tables were vacuumed (with FULL > ANALYZE options). So the procedure was this > > 1) drop, create and fill table B (aggregated data from A, C, D) > 2) copy 'old' data from A, C and D to A_old, C_old a D_old > 3) delete old data from A, C, D > 4) dump data from A_old, C_old and D_old > 5) truncate tables A, C, D > 6) vacuum full analyze tables A, C, D, A_old, C_old and D_old > > So the dump of the fatabase has about 1.2 GB of data, from which about > 1 GB is in the B table (the one rebuilt in step 1). This was done yesterday. > > The problem is this - today, we run a scheduled VACUUM FULL ANALYZE for > the whole database, and it runs for about 10 hours already, which is > much more than usual (and it is still running). Probably the indexes are bloated after the vacuum full. I think the best way to get rid of the "fat" is to recreate both tables and indexes anew. For this the best tool would be to CLUSTER the tables on some index, probably the primary key. This will be much faster than VACUUMing the tables, and the indexes will be much smaller as result. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc.