Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 849D9634C50 for ; Wed, 13 Jan 2010 12:52:38 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 92857-05 for ; Wed, 13 Jan 2010 16:52:28 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-fx0-f227.google.com (mail-fx0-f227.google.com [209.85.220.227]) by mail.postgresql.org (Postfix) with ESMTP id C074F634BAB for ; Wed, 13 Jan 2010 12:52:27 -0400 (AST) Received: by fxm27 with SMTP id 27so768182fxm.3 for ; Wed, 13 Jan 2010 08:52:26 -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; bh=xa59EWaPtFu0dpyDK7l06DeOW3cIFebPfB7OuCEVMHk=; b=BcCoIvHFvk34zgtFl/L+MrorFDJFsGISYy1bW/0ZvXC5ucYc5ufqk6wxR1lhf9noPP MeYwNqzTY07eO5T89yV/Jv8fH8lgA3FBof+vzg3HnqFLUMmF22Wqgq75Nim1qGYDiy/x X11R/LIXzwJkEe7Q4ocWOjfN/XWvynjTyzGPs= 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; b=lazAah8ENWIyp/nxQdSbIaRfjtSDNv/NiGBHzQ1874hma4sfCof/fivxcZTF5Ga4Oi 5gHbEET0KUyzKoJL+nwsSijWyCT0mMt7HijT/RAMhW+NIYRzijcHUCegOeriw1P8oX6g fsB9SWeL+npPnnmj5i2HWPP7Uq/xMNjMSwPCA= MIME-Version: 1.0 Received: by 10.216.154.70 with SMTP id g48mr1468170wek.109.1263401545479; Wed, 13 Jan 2010 08:52:25 -0800 (PST) In-Reply-To: References: Date: Wed, 13 Jan 2010 09:52:23 -0700 Message-ID: Subject: Re: a heavy duty operation on an "unused" table kills my server From: Scott Marlowe To: Eduardo Piombino Cc: pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.589 tagged_above=-10 required=5 tests=BAYES_00=-2.599, FH_DATE_PAST_20XX=3.188 X-Spam-Level: X-Archive-Number: 201001/256 X-Sequence-Number: 37136 On Tue, Jan 12, 2010 at 9:59 PM, Eduardo Piombino wrote: ... > Now, with this experience, I tried a simple workaround. > Created an empty version of "a" named "a_empty", identical in every sense. > renamed "a" to "a_full", and "a_empty" to "a". This procedure costed me like > 0 seconds of downtime, and everything kept working smoothly. Maybe a cpl of > operations could have failed if they tried to write in the very second that > there was actually no table named "a", but since the operation was > transactional, the worst scenario was that if the operation should have > failed, the client application would just inform of the error and ask the > user for a retry. No big deal. > > Now, this table, that is totally unattached to the system in every way (no > one references this table, its like a dumpster for old records), is not > begin accessed by no other thread in the system, so an ALTER table on it, to > turn a char(255) to char(250), should have no effect on the system. > > So, with this in mind, I tried the ALTER TABLE this time on the "a_full" > (totally unrelated) table. > The system went non-responsive again, and this time it had nothing to do > with threads waiting for the alter table to complete. The pgAdmin GUI went > non-responsive, as well as the application's server GUI, whose threads kept > working on the background, but starting to take more and more time for every > clients request (up to 25 seconds, which are just ridiculous and completely > unacceptable in normal conditions). OK, I'm not entirely sure this table is not still locking something else. If you make a copy by doing something like: select * into test_table from a; and then alter test_table do you still get the same problems? If so, then it is an IO issue, most likely. If not, then there is some client connection still referencing this table or something and that could cause this type of behaviour as well.