Re: Question about ALTER TABLE DROP CONSTRAINT on 9.1 -- psql crashes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
Cc: Greg Williamson <gwilliamson39(at)yahoo(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Question about ALTER TABLE DROP CONSTRAINT on 9.1 -- psql crashes
Date: 2012-08-10 04:20:48
Message-ID: 13011.1344572448@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Craig Ringer <ringerc(at)ringerc(dot)id(dot)au> writes:
> On 08/10/2012 10:06 AM, Tom Lane wrote:
>> That sure sounds like the source of your problem. It might be sane if
>> it killed only processes that *had been idle* for at least three
>> seconds, but I'm not sure there is any easy way to determine that ...

> wouldn't:

> select * from pg_stat_activity
> where current_query = '<IDLE> in transaction'
> AND query_start < current_timestamp - INTERVAL '3 seconds';

> do it?

No, that would find sessions that were idle and whose last command
started at least 3 seconds ago. But it might have completed only
microseconds ago. The symptoms Greg is describing are consistent
with this kill script running during a short interval between his
index-build command and his COMMIT.

As of 9.2 there's a "state_change" timestamp column in pg_stat_activity
that would provide a safer check, but it's not in existing releases ...

regards, tom lane

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Craig Ringer 2012-08-10 05:08:24 Re: Question about ALTER TABLE DROP CONSTRAINT on 9.1 -- psql crashes
Previous Message Craig Ringer 2012-08-10 02:24:40 Re: Question about ALTER TABLE DROP CONSTRAINT on 9.1 -- psql crashes