X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 277DAD1D55A for ; Mon, 9 Feb 2004 18:55:25 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 64765-08 for ; Mon, 9 Feb 2004 14:55:16 -0400 (AST) Received: from bramble.mmrd.com (unknown [65.217.53.66]) by svr1.postgresql.org (Postfix) with ESMTP id 0ED30D1D489 for ; Mon, 9 Feb 2004 14:55:14 -0400 (AST) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by bramble.mmrd.com (8.12.8/8.12.8) with ESMTP id i19IL9cM024813; Mon, 9 Feb 2004 13:21:09 -0500 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [192.168.3.55]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id i19ItAl25816; Mon, 9 Feb 2004 13:55:10 -0500 Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2657.72) id XT8816ZS; Mon, 9 Feb 2004 13:55:08 -0500 Subject: Re: Preventing duplicate vacuums? From: Robert Treat To: Tom Lane Cc: Josh Berkus , pgsql-hackers@postgresql.org In-Reply-To: <17544.1076137674@sss.pgh.pa.us> References: <200402051237.14615.josh@agliodbs.com> <11820.1076015269@sss.pgh.pa.us> <200402051351.49983.josh@agliodbs.com> <1076106724.30335.41.camel@camel> <17544.1076137674@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 09 Feb 2004 13:55:09 -0500 Message-Id: <1076352909.30149.248.camel@camel> Mime-Version: 1.0 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/355 X-Sequence-Number: 49944 On Sat, 2004-02-07 at 02:07, Tom Lane wrote: > Robert Treat writes: > > Don't know if I would agree for sure, but i the second vacuum could see > > that it is being blocked by the current vacuum, exiting out would be a > > bonus, since in most scenarios you don't need to run that second vacuum > > so it just ends up wasting resources (or clogging other things up with > > it lock) > > This would be reasonable if we could do it, but the present lock manager > doesn't provide any way to tell what sort of lock is blocking you. > There are some cases in which it isn't obvious anyway. For instance, > suppose an ALTER TABLE (which wants an exclusive lock) is queued up > waiting for the currently-running VACUUM. An incoming new VACUUM > request will queue behind the ALTER. Which lock would you say is > blocking it ... and does an honest answer to that question jibe with > your preference about whether the second VACUUM should give up? > ISTM that both sides have trouble, since you could just as easily have vacuum queued up behind an alter we your second vacuum comes in... > A chintzy way out would be for VACUUM to just exit if it can't > immediately acquire lock, regardless of the cause. This wouldn't be > too useful for VACUUM FULL, but plain VACUUM is not blocked by very many > common operations other than another VACUUM, so most of the time it > would do what you want. I could possibly be talked into supporting an > option to do that. > This seems pretty useful to me. I thought about doing things like setting statement_timeout to some low number but that would generally cause the vacuum to timeout as well. Looking through postgresql.conf nothing else seems to apply... ISTR people asking for a general "lock_timeout" param that would cancel queries if they wait for a lock longer than x milliseconds... this seems like very similar functionality... Robert Treat -- Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL