X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4C6E8D852D for ; Sun, 4 Sep 2005 20:01:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07225-01 for ; Sun, 4 Sep 2005 23:01:10 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 059ACD81A3 for ; Sun, 4 Sep 2005 20:01:08 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j84N1AWn009275; Sun, 4 Sep 2005 19:01:10 -0400 (EDT) To: jan.l.peterson@gmail.com Cc: pgsql-performance@postgresql.org Subject: Re: poor VACUUM performance on large tables In-reply-to: <72e966b00509032316166ff0cf@mail.gmail.com> References: <72e966b00509032316166ff0cf@mail.gmail.com> Comments: In-reply-to Jan Peterson message dated "Sun, 04 Sep 2005 00:16:10 -0600" Date: Sun, 04 Sep 2005 19:01:10 -0400 Message-ID: <9274.1125874870@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200509/71 X-Sequence-Number: 14379 Jan Peterson writes: > We have been experiencing poor performance of VACUUM in our production > database. Which PG version, exactly? > Everything works great until our rolling delete kicks in. Of course, > we are doing periodic VACUUMS on all tables, with frequent VACUUMs on > the more active tables. The problem arises when we start deleting the > bulk data and have to VACUUM pg_largeobject and our other larger > tables. We have seen VACUUM run for several hours (even tens of > hours). Plain VACUUM (not FULL) certainly ought not take that long. (If you're using VACUUM FULL, the answer is going to be "don't do that".) What maintenance_work_mem (or vacuum_mem in older releases) are you running it under? Can you get VACUUM VERBOSE output from some of these cases so we can see which phase(s) are eating the time? It'd also be interesting to watch the output of vmstat or local equivalent --- it might just be that your I/O capability is nearly saturated and VACUUM is pushing the system over the knee of the response curve. If so, the vacuum delay options of 8.0 would be worth experimenting with. > Statistics are also skewed during this > process and we have observed the planner choosing sequential scans on > tables where it is obvious that an index scan would be more efficient. That's really pretty hard to believe; VACUUM doesn't affect the statistics until the very end. Can you give some specifics of how the "statistics are skewed"? regards, tom lane