Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 88F4014E23D3 for ; Wed, 21 Dec 2011 12:03:22 -0400 (AST) Received: from mail-gy0-f174.google.com ([209.85.160.174]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RdOdS-0000S5-KH for pgsql-admin@postgresql.org; Wed, 21 Dec 2011 16:03:22 +0000 Received: by ghbz12 with SMTP id z12so4895526ghb.19 for ; Wed, 21 Dec 2011 08:03:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=TbMXyYO8u9+K5S1izD0QLEZ5k0hSmzJLxpYSPF0Rijc=; b=QELAEL2SgfWoFM6ptDf6uQjPs0UP2+8F3HJ6u29YEGLpk2QFBSN6cEwW/Dk7FEAk/r N877q9iffN9Hzx2R8Q1Zr+urn5L/wODWvj6IDhLWYEvS3i/8M5Msq+FRpvcbIIUD9Dc/ 8z7JeLKYYzdMFDHkDMwG2mq7Kihp4/s/QpYos= Received: by 10.50.193.229 with SMTP id hr5mr4139893igc.15.1324483385976; Wed, 21 Dec 2011 08:03:05 -0800 (PST) Received: from [192.168.11.4] ([114.95.167.241]) by mx.google.com with ESMTPS id 36sm18398238ibc.6.2011.12.21.08.03.01 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Dec 2011 08:03:05 -0800 (PST) Message-ID: <4EF20333.8020404@gmail.com> Date: Thu, 22 Dec 2011 00:02:59 +0800 From: Rural Hunter User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: =?UTF-8?B?QsOocnRvIMOrZCBTw6hyYQ==?= CC: pgsql-admin@postgresql.org, Kevin Grittner , Jerry Sievers Subject: Re: lock problem References: <4EF18A8A0200002500043F0A@gw.wicourts.gov> <4EF1F027.507@gmail.com> <87aa6m7xqz.fsf@comcast.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201112/112 X-Sequence-Number: 38870 well, thanks. I checked the application and found there was a bug causing many queries were updating the same row. However, those updates are just single statement, no multi-statement transaction involved. So I still have this question: same statement A,B,C,D update same row. The start order is A->B->C-D. From what I've gotten, B/C/D got the lock before A. Why did that happen? 于2011年12月21日 23:40:35,Bèrto ëd Sèra写到: > Hi, > > > I dig another case more and found something interesting. it's > actually > > waiting for a lock of type transactionid. I ran the query below 3 > > Normal. That's the kind of lock you are waiting for when some other > transaction has touched the same rows for update that you are > attempting. > > > Record level locks are stored on the records themselves, so you won't > see them explicitly mentioned in views like pg_locks: > "Although tuples are a lockable type of object, information about > row-level locks is stored on disk, not in memory, and therefore > row-level locks normally do not appear in this view. If a transaction > is waiting for a row-level lock, it will usually appear in the view as > waiting for the permanent transaction ID of the current holder of that > row lock." > See http://www.postgresql.org/docs/9.1/static/explicit-locking.html > > Bèrto > -- > ============================== > If Pac-Man had affected us as kids, we'd all be running around in a > darkened room munching pills and listening to repetitive music.