Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id DDCA96356F9 for ; Mon, 2 Mar 2009 15:56:28 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 62303-01-9 for ; Mon, 2 Mar 2009 15:56:25 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp2.ca.com (smtp2.ca.com [141.202.248.13]) by mail.postgresql.org (Postfix) with ESMTP id 2E12C635A05 for ; Mon, 2 Mar 2009 15:56:11 -0400 (AST) Received: from athena.ca.com ([130.200.164.17]) by smtp2.ca.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 2 Mar 2009 14:56:09 -0500 Message-ID: <49AC39CA.5080604@ca.com> Date: Mon, 02 Mar 2009 11:55:54 -0800 From: Brian Cox User-Agent: Thunderbird 2.0.0.19 (X11/20081209) MIME-Version: 1.0 To: "Tom Lane [tgl@sss.pgh.pa.us]" CC: "pgsql-performance@postgresql.org" Subject: Re: "slow" queries Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 02 Mar 2009 19:56:09.0893 (UTC) FILETIME=[EEA0D550:01C99B70] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200903/16 X-Sequence-Number: 32938 Tom Lane [tgl@sss.pgh.pa.us] wrote: > If you hadn't left out the "granted" column we could be more sure, > but what it looks like to me is the DROP (pid 13842) is stuck behind > the transaction (pid 13833). In particular these two rows of > pg_locks look like a possible conflict: > > > relation | 26472437 | 26472508 | | 15/69749 > > | 13842 | AccessExclusiveLock > > > relation | 26472437 | 26472508 | | 11/131 > > | 13833 | AccessShareLock select c.oid,c.relname,l.pid,l.mode,l.granted from pg_class c join pg_locks l on c.oid=l.relation order by l.pid; 26472508 | ts_transets | 13833 | AccessShareLock | t 26472508 | ts_transets | 13842 | AccessExclusiveLock | f pid 13833 is the idle transaction and 13842 is doing the drop table. So, the idle transaction is the problem. Thanks to you, Scott Carey and Robert Haas for pointing this out. However, why does the drop of ts_defects_20090227 need exclusive access to ts_transets? I assume it must be due to this FK? alter table ts_defects_20090227 add constraint FK34AA2B629DADA24 foreign key (ts_transet_id) references ts_transets; Thanks again, Brian