pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Deadlock on "select ... for update"?
3+ messages / 2 participants
[nested] [flat]

* Deadlock on "select ... for update"?
@ 2011-11-29 18:15 Craig James <craig_james@emolecules.com>
  2011-11-29 18:36 ` Re: Deadlock on "select ... for update"? Scott Marlowe <scott.marlowe@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Craig James @ 2011-11-29 18:15 UTC (permalink / raw)
  To: pgsql-admin

Several times recently one of our databases has gotten stuck with the
following situation:

postgres=# select datname, procpid, usename, current_query from
pg_stat_activity where current_query != '<IDLE>';
  datname   | procpid | usename  |
    current_query
------------+---------+----------+--------------------------------------------------------------------------------------------------------
 emolecules |   13503 | customerdb | select tableid from hitlist_table_pool
where hitlistid <= 0 for update
 emolecules |   32082 | customerdb | select tableid from hitlist_table_pool
where hitlistid <= 0 for update
 emolecules |   17974 | customerdb | select tableid from hitlist_table_pool
where hitlistid <= 0 for update
 emolecules |   31299 | customerdb | select tableid from hitlist_table_pool
where hitlistid = 0 limit 1 for update
 emolecules |   30247 | customerdb | select tableid from hitlist_table_pool
where hitlistid = 0 limit 1 for update
 postgres   |    1705 | postgres | select datname, procpid, usename,
current_query from pg_stat_activity where current_query != '<IDLE>';
 emolecules |   28866 | customerdb | <IDLE> in transaction
 emolecules |   21394 | customerdb | select tableid from hitlist_table_pool
where hitlistid = 0 limit 1 for update
 emolecules |   22237 | customerdb | select tableid from hitlist_table_pool
where hitlistid = 0 limit 1 for update
(9 rows)

It's obvious that they're all waiting ... but for what?  The "<IDLE>"
process looks like the culprit, but how do I figure out what it's doing?

The next time this happens, what queries can I run to help diagnose what's
going on?

This is PG 8.4.4 on Ubuntu 10.

Thanks,
Craig

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Deadlock on "select ... for update"?
  2011-11-29 18:15 Deadlock on "select ... for update"? Craig James <craig_james@emolecules.com>
@ 2011-11-29 18:36 ` Scott Marlowe <scott.marlowe@gmail.com>
  2011-11-30 18:08   ` Re: Deadlock on "select ... for update"? Craig James <craig_james@emolecules.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Scott Marlowe @ 2011-11-29 18:36 UTC (permalink / raw)
  To: Craig James <craig_james@emolecules.com>; +Cc: pgsql-admin

On Tue, Nov 29, 2011 at 11:15 AM, Craig James
<craig_james@emolecules.com> wrote:
> Several times recently one of our databases has gotten stuck with the
> following situation:
>
> postgres=# select datname, procpid, usename, current_query from
> pg_stat_activity where current_query != '<IDLE>';
>   datname   | procpid | usename  |
>   current_query
> ------------+---------+----------+--------------------------------------------------------------------------------------------------------
>  emolecules |   13503 | customerdb | select tableid from hitlist_table_pool
> where hitlistid <= 0 for update
>  emolecules |   32082 | customerdb | select tableid from hitlist_table_pool
> where hitlistid <= 0 for update
>  emolecules |   17974 | customerdb | select tableid from hitlist_table_pool
> where hitlistid <= 0 for update
>  emolecules |   31299 | customerdb | select tableid from hitlist_table_pool
> where hitlistid = 0 limit 1 for update
>  emolecules |   30247 | customerdb | select tableid from hitlist_table_pool
> where hitlistid = 0 limit 1 for update
>  postgres   |    1705 | postgres | select datname, procpid, usename,
> current_query from pg_stat_activity where current_query != '<IDLE>';
>  emolecules |   28866 | customerdb | <IDLE> in transaction
>  emolecules |   21394 | customerdb | select tableid from hitlist_table_pool
> where hitlistid = 0 limit 1 for update
>  emolecules |   22237 | customerdb | select tableid from hitlist_table_pool
> where hitlistid = 0 limit 1 for update
> (9 rows)
>
> It's obvious that they're all waiting ... but for what?  The "<IDLE>"
> process looks like the culprit, but how do I figure out what it's doing?
> The next time this happens, what queries can I run to help diagnose what's
> going on?
> This is PG 8.4.4 on Ubuntu 10.

Does this help?

http://wiki.postgresql.org/wiki/Lock_Monitoring



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Deadlock on "select ... for update"?
  2011-11-29 18:15 Deadlock on "select ... for update"? Craig James <craig_james@emolecules.com>
  2011-11-29 18:36 ` Re: Deadlock on "select ... for update"? Scott Marlowe <scott.marlowe@gmail.com>
@ 2011-11-30 18:08   ` Craig James <craig_james@emolecules.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Craig James @ 2011-11-30 18:08 UTC (permalink / raw)
  To: Scott Marlowe <scott.marlowe@gmail.com>; +Cc: pgsql-admin

On 11/29/11 10:36 AM, Scott Marlowe wrote:
> On Tue, Nov 29, 2011 at 11:15 AM, Craig James
> <craig_james@emolecules.com>  wrote:
>> Several times recently one of our databases has gotten stuck with the
>> following situation:
>>
>> postgres=# select datname, procpid, usename, current_query from
>> pg_stat_activity where current_query != '<IDLE>';
>>    datname   | procpid | usename  |
>>    current_query
>> ------------+---------+----------+--------------------------------------------------------------------------------------------------------
>>   emolecules |   13503 | customerdb | select tableid from hitlist_table_pool
>> where hitlistid<= 0 for update
>>   emolecules |   32082 | customerdb | select tableid from hitlist_table_pool
>> where hitlistid<= 0 for update
>>   emolecules |   17974 | customerdb | select tableid from hitlist_table_pool
>> where hitlistid<= 0 for update
>>   emolecules |   31299 | customerdb | select tableid from hitlist_table_pool
>> where hitlistid = 0 limit 1 for update
>>   emolecules |   30247 | customerdb | select tableid from hitlist_table_pool
>> where hitlistid = 0 limit 1 for update
>>   postgres   |    1705 | postgres | select datname, procpid, usename,
>> current_query from pg_stat_activity where current_query != '<IDLE>';
>>   emolecules |   28866 | customerdb |<IDLE>  in transaction
>>   emolecules |   21394 | customerdb | select tableid from hitlist_table_pool
>> where hitlistid = 0 limit 1 for update
>>   emolecules |   22237 | customerdb | select tableid from hitlist_table_pool
>> where hitlistid = 0 limit 1 for update
>> (9 rows)
>>
>> It's obvious that they're all waiting ... but for what?  The "<IDLE>"
>> process looks like the culprit, but how do I figure out what it's doing?
>> The next time this happens, what queries can I run to help diagnose what's
>> going on?
>> This is PG 8.4.4 on Ubuntu 10.
> Does this help?
>
> http://wiki.postgresql.org/wiki/Lock_Monitoring

Yes, thanks! That's exactly what I needed.

Craig




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2011-11-30 18:08 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-11-29 18:15 Deadlock on "select ... for update"? Craig James <craig_james@emolecules.com>
2011-11-29 18:36 ` Scott Marlowe <scott.marlowe@gmail.com>
2011-11-30 18:08   ` Craig James <craig_james@emolecules.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox