Re: "slow" queries

From: Brian Cox <brian(dot)cox(at)ca(dot)com>
To: "Tom Lane [tgl(at)sss(dot)pgh(dot)pa(dot)us]" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: "slow" queries
Date: 2009-03-02 19:55:54
Message-ID: 49AC39CA.5080604@ca.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Tom Lane [tgl(at)sss(dot)pgh(dot)pa(dot)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 <IDLE> 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

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2009-03-02 20:11:07 Re: "slow" queries
Previous Message Tom Lane 2009-03-02 19:29:31 Re: "slow" queries