Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 615526328BD for ; Sun, 22 Aug 2010 15:01:08 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 03019-09 for ; Sun, 22 Aug 2010 18:01:00 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.187]) by mail.postgresql.org (Postfix) with ESMTP id F03B863280E for ; Sun, 22 Aug 2010 15:01:00 -0300 (ADT) Received: from [192.168.1.151] (static-71-179-240-8.bltmmd.fios.verizon.net [71.179.240.8]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0MV0jR-1OLNlo43pt-00YwyX; Sun, 22 Aug 2010 20:00:54 +0200 Message-ID: <4C7165D1.1040402@2ndquadrant.com> Date: Sun, 22 Aug 2010 14:00:49 -0400 From: Greg Smith User-Agent: Thunderbird 2.0.0.24 (X11/20100317) MIME-Version: 1.0 To: Alexandre de Arruda Paes CC: pgsql-performance@postgresql.org Subject: Re: Fwd: Vacuum Full + Cluster + Vacuum full = non removable dead rows References: <14512.1282137722@sss.pgh.pa.us> <4C6CEE4202000025000348D6@gw.wicourts.gov> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:N3Rx6qlaxm/ywqQV6pyDBlCpzjUC7e+1437vjH7P53c Xow+Rc1TScugeEX9IlwVRpewKlfOVc3GMLMT3KtFkRm2eu1Q7S DGLAbOkia4bbi5TsmqhhP6U+YU2yQgPsnKXYlB1OvyGEri/sKP ZQCOlUejzgMrcp5rtUwWduXI5GIgGDAzdpAhOSO9NEq+L84w0x IR+yiFwWgLaxzg4l5bkPyG2F3w0SCBOfUhZW8+ExCQ= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201008/245 X-Sequence-Number: 40088 Alexandre de Arruda Paes wrote: > Unfortunately, the customer can't wait for the solution and the > programmer eliminated the > use of this table by using a in-memory array. Well that will be fun. Now they've traded their old problem for a new one--cache inconsistency between the data in memory and what sitting in the database. The fun apart about that is that the cache mismatch bugs you'll run into are even more subtle, frustrating, and difficult to replicate on demand than the VACUUM ones. > Only for discussion: the CLUSTER command, in my little knowledge, is a > intrusive command that's cannot recover the dead tuples too. > Only TRUNCATE can do this job, but obviously is not applicable all the > time. Yes, CLUSTER takes a full lock on the table and rewrites a new one with all the inactive data removed. The table is unavailable to anyone else while that's happening. Some designs separate their data into partitions in a way that it's possible to TRUNCATE/DROP the ones that are no longer relevant (and are possibly filled with lots of dead rows) in order to clean them up without using VACUUM. This won't necessarily help with long-running transactions though. If those are still referring to do data in those old partitions, removing them will be blocked for the same reason VACUUM can't clean up inside of them--they data is still being used by an active transaction. -- Greg Smith 2ndQuadrant US Baltimore, MD PostgreSQL Training, Services and Support greg@2ndQuadrant.com www.2ndQuadrant.us