Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 8DD3AEB289A for ; Wed, 21 Dec 2011 21:45:03 -0400 (AST) Received: from mail-iy0-f174.google.com ([209.85.210.174]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RdXiP-0001jM-Et for pgsql-admin@postgresql.org; Thu, 22 Dec 2011 01:45:03 +0000 Received: by iaeh11 with SMTP id h11so12712909iae.19 for ; Wed, 21 Dec 2011 17:44:48 -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=Hfy2d1ZckryHMFwJeN/eZ5QgGooKE7JZ4qZO07HYlsU=; b=COKgAJIR2Fbtup9hkCBye83lO0VWesEQivBLBeouvNrDuJkq/XmUFSsvV3dPsoQ5M2 hzXbmeunJJn3oVzeFR4xCfQi/R0pwVO7fVkGz0EcH3vSnGfy8+U/T1kKE0qo08zxvymO TsJ4lySEtOdSVKsxB2fIlXr01Lwak1z/pytNU= Received: by 10.50.190.201 with SMTP id gs9mr6501509igc.1.1324518288760; Wed, 21 Dec 2011 17:44:48 -0800 (PST) Received: from [192.168.1.4] ([116.226.65.236]) by mx.google.com with ESMTPS id rc7sm32811733igb.0.2011.12.21.17.44.44 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Dec 2011 17:44:47 -0800 (PST) Message-ID: <4EF28B8A.1060602@gmail.com> Date: Thu, 22 Dec 2011 09:44:42 +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: Kevin Grittner CC: Jerry Sievers , pgsql-admin@postgresql.org, berto.d.sera@gmail.com Subject: Re: lock problem References: <4EF18A8A0200002500043F0A@gw.wicourts.gov> <4EF1F027.507@gmail.com> <87aa6m7xqz.fsf@comcast.net> <4EF20333.8020404@gmail.com> <4EF1B04D0200002500043F4C@gw.wicourts.gov> In-Reply-To: <4EF1B04D0200002500043F4C@gw.wicourts.gov> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201112/121 X-Sequence-Number: 38879 hmm....no I didn't do anything. is the lock priority decided by OS not the DB? I'm confused here. B/C/D started several mins later than A here while the update statement takes no more than 1 second. of coz there are hundreds of connections trying to acquire the lock during that time. 于2011年12月22日 0:09:17,Kevin Grittner写到: > Rural Hunter wrote: > >> 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? > > Did you do anything to prevent it from happening? If not, the OS > scheduler is going to give time to one process or another in a > fairly unpredictable way. > > -Kevin >