Re: Weird problem that enormous locks

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Weird problem that enormous locks
Date: 2011-07-14 04:35:30
Message-ID: 4E1E7212.6090007@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 07/13/11 8:47 PM, Tony Wang wrote:
> It's a game server, and the queries are updating users' money, as
> normal. The sql is like "UPDATE player SET money = money + 100 where
> id = 12345". The locks were RowExclusiveLock for the table "player"
> and the indexes. The weird thing is there was another ExclusiveLock
> for the table "player", i.e. "player" got two locks,
> one RowExclusiveLock and one ExclusiveLock.

that query should be quite fast. is it part of a larger transaction? is
there any possibility of multiple sessions/connections accessing the
same player.id?

it would be interesting to identify the process that issued the
exclusive lock and determine what query/queries its made. if its not
apparent in pg_stat_activity, perhaps enable logging of all DDL
commands, and check the logs.

if there's a lot of active queries (you ahve 800 connections)

select count(*),current_query from pg_stat_activity group by
current_query order by count(*) desc;

can help you make sense of them.

--
john r pierce N 37, W 122
santa cruz ca mid-left coast

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tony Wang 2011-07-14 05:00:13 Re: Weird problem that enormous locks
Previous Message Tony Wang 2011-07-14 03:47:01 Re: Weird problem that enormous locks