Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id B3EF91337B51 for ; Mon, 21 Feb 2011 23:43:48 -0400 (AST) 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 84552-01 for ; Tue, 22 Feb 2011 03:43:41 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.catalyst.net.nz (bertrand.catalyst.net.nz [202.78.240.40]) by mail.postgresql.org (Postfix) with ESMTP id AACF61337990 for ; Mon, 21 Feb 2011 23:43:40 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by mail.catalyst.net.nz (Postfix) with ESMTP id C005731F8E for ; Tue, 22 Feb 2011 16:43:38 +1300 (NZDT) X-Virus-Scanned: Debian amavisd-new at catalyst.net.nz Received: from mail.catalyst.net.nz ([127.0.0.1]) by localhost (bertrand.catalyst.net.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vvrD6biCbGNJ for ; Tue, 22 Feb 2011 16:43:38 +1300 (NZDT) Received: from [IPv6:2404:130:0:1000:222:15ff:fe5c:2471] (unknown [IPv6:2404:130:0:1000:222:15ff:fe5c:2471]) (Authenticated sender: mark.kirkwood) by mail.catalyst.net.nz (Postfix) with ESMTPSA id 1AC0831C72 for ; Tue, 22 Feb 2011 16:43:38 +1300 (NZDT) Message-ID: <4D6330E9.6030809@catalyst.net.nz> Date: Tue, 22 Feb 2011 16:43:37 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Lightning/1.0b2 Thunderbird/3.1.7 MIME-Version: 1.0 To: pgsql-bugs@postgresql.org Subject: Hung Vacuum in 8.3 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201102/179 X-Sequence-Number: 29451 This is 8.3.14 on Debian Lenny x86-64. I'm seeing a hung vacuum: postgres=# select procpid, query_start,waiting, current_query from pg_stat_activity where current_query like '%VACUUM%'; procpid | query_start | waiting | current_query --------+-------------------------------+---------+--------------------------------------------------------------------------------------------- 7347 | 2011-02-22 06:02:02.400247+13 | f | VACUUM ANALYZE; at approx 1300 (so it has been sitting there for approx 7 hours, normal database vacuum time is 10 minutes). Now according to pg_stat_activity and pg_locks it is *not* waiting for a lock, but no vacuuming appears to be going on. strace says: $ strace -p 7347 Process 7347 attached - interrupt to quit semop(33456157, 0x7ffff512bad0, 1 Ok, so we are waiting on a semaphore - hmm, why is it not showing up as waiting on a lock of some kind? Of interest is this: postgres=# select procpid, query_start, current_query from pg_stat_activity order by query_start limit 1; procpid | query_start | current_query ---------+-------------------------------+------------------------------------------------------------------------------------- 25953 | 2011-02-22 04:24:07.417138+13 | SELECT n.node_id, n.node_ -- long query, joining several large tables - text snipped So this guy had been running from before the vacuum started, so probably vacuum is wanting to do lazy_truncate_heap() on one of the tables in the join (no gdb on this box unfortunately). I am however still puzzled about why no locks are being waited on. I have canceled the vacuum, but any suggestions for getting more diag info for next time? regards Mark