Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1heKcn-0003OM-4t for pgsql-general@arkaria.postgresql.org; Fri, 21 Jun 2019 14:34:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1heKcm-0003Oy-0D for pgsql-general@arkaria.postgresql.org; Fri, 21 Jun 2019 14:34:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1heKcl-0003Oq-Mu for pgsql-general@lists.postgresql.org; Fri, 21 Jun 2019 14:34:43 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1heKch-0001hK-CX for pgsql-general@postgresql.org; Fri, 21 Jun 2019 14:34:43 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 1BCF4252; Fri, 21 Jun 2019 10:34:36 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 21 Jun 2019 10:34:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=P mr+0ewQ37CDWG3+h78MolxZGwNew4vNBrFagzHxIQ0=; b=fHTuGVEjGUIdCFur7 cqzDO3W15M1lS2SafJBC1s943ESJI3pcmV2t74+7PHtGiKOQD7kGxjuSbpOfNw3G fcu0A96urDKKhwhwJ08rvQKk7LuonJBzlDcyQXbehp565XuFaUssJstQRTxoJNI2 K/lac6uTN4gItlivnM08o1erqrbanUvg6B6co7PBHpVllPKLyLQuyezidhVBjQlj PivFkgOYXyOVx3FleETkRZAv64t7/aBx0EByna/X4xT8b/4qoCCt56EL7YAsn4ig MWLUtmTIE9kwIyk7cw86YVlp1wkIs/ShHXZl2Cjdj/Uy7QsDiHbQ9Mw7xR/BawLL sIFCA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=Pmr+0ewQ37CDWG3+h78MolxZGwNew4vNBrFagzHxI Q0=; b=UeOHF8CMCl4sT29VsqC9oqwgumz7I7zXW4bmPlbqCF++irErcY71Glyr3 Xfmfs7gi6V/XGrNYFwpteaATmQtm/kb5kfm6KzKtENVDm9bht2DUJ35txTJ5X6Md 8VWJ4z/THKpyQGjdFZrIHoeZ25+6p6l+3NFrjan2sF+OPIzHDUT7BO9OHDtoVmic GdaSOAYKVfcdUbbtzFPSs38pAkjv1dINlgDYl1lBfVWPYvfIA551Wqt4NH2LDYLT LpbjM1ML2yj6l33FEHvcE3fQ5aMAc+RBNVmylbHG50sBsRZBpw/vI8NlI09kWj9p mDi9phS14BhAnvSYemVOq0OvnXWKw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrtdeigdekudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesthejre dttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhl rghvvghrsegrkhhlrghvvghrrdgtohhmqeenucffohhmrghinhepphhoshhtghhrvghsqh hlrdhorhhgnecukfhppeejuddrvdduvddrudehtddrvddtvdenucfrrghrrghmpehmrghi lhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhenucevlh hushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [192.168.1.4] (unknown [71.212.150.202]) by mail.messagingengine.com (Postfix) with ESMTPA id AF7E28005C; Fri, 21 Jun 2019 10:34:34 -0400 (EDT) Subject: Re: R: Problem with row-level lock To: Job , "pgsql-general@postgresql.org" References: <88EF58F000EC4B4684700C2AA3A73D7A082D27F19C04@W2008DC01.ColliniConsulting.lan> <88EF58F000EC4B4684700C2AA3A73D7A082D27F19C06@W2008DC01.ColliniConsulting.lan> <88EF58F000EC4B4684700C2AA3A73D7A082D27F19C07@W2008DC01.ColliniConsulting.lan> From: Adrian Klaver Message-ID: Date: Fri, 21 Jun 2019 07:34:33 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1 MIME-Version: 1.0 In-Reply-To: <88EF58F000EC4B4684700C2AA3A73D7A082D27F19C07@W2008DC01.ColliniConsulting.lan> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 6/21/19 1:40 AM, Job wrote: > Dear Adrian, > > thank you for the reply! > >>> i am struggling with a problem due, sometime, to a double concurrent update on the same row of a table. > >> What is the error message you get? > > We have no error, but the two queries, in "Lock wait", keep stucked for some minutes before completed. > Are there any parameters useful to "serialize" in some way two different Update queries - for the same field in the same row - arriving concurrently? > > I was looking at the lock_timeout parameter: could it be what i am looking for? If I understood your OP you do not have control of what the client, correct? If that is the case it makes what you want to achieve more difficult. To understand what can be done you will want to take a look at: The locking choices in Postgres. https://www.postgresql.org/docs/11/mvcc.html The lock timeouts available(though I don't think they apply to your case) https://www.postgresql.org/docs/11/runtime-config-locks.html How to change the transaction modes https://www.postgresql.org/docs/11/sql-set-transaction.html > > Thank you! > Franco > -- Adrian Klaver adrian.klaver@aklaver.com