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 1ihcrw-0006L5-TD for pgsql-general@arkaria.postgresql.org; Wed, 18 Dec 2019 17:12:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ihcrv-0007JS-JR for pgsql-general@arkaria.postgresql.org; Wed, 18 Dec 2019 17:12:15 +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 1ihcrv-0007JL-96 for pgsql-general@lists.postgresql.org; Wed, 18 Dec 2019 17:12:15 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ihcrs-000276-Qz for pgsql-general@postgresql.org; Wed, 18 Dec 2019 17:12:14 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id xBIHC7pk007595; Wed, 18 Dec 2019 12:12:07 -0500 From: Tom Lane To: Justin cc: Daniel Verite , shalini@saralweb.com, Rene Romero Benavides , Postgres General Subject: Re: Tuple concurrency issue in large objects In-reply-to: References: <0874ff74-7ffc-4a1d-ba26-1a617bb34c59@email.android.com> <70757632-58a5-4bf1-a4b8-af2ed5a4fa9a@manitou-mail.org> <5126.1576685560@sss.pgh.pa.us> Comments: In-reply-to Justin message dated "Wed, 18 Dec 2019 11:43:50 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7593.1576689127.1@sss.pgh.pa.us> Date: Wed, 18 Dec 2019 12:12:07 -0500 Message-ID: <7594.1576689127@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Justin writes: > I now see what is causing this specific issue... > The update and row versions is happening on 2kb chunk at a time, That's > going to make tracking what other clients are doing a difficult task. Yeah, it's somewhat unfortunate that the chunkiness of the underlying data storage becomes visible to clients if they try to do concurrent updates of the same large object. Ideally you'd only get a concurrency failure if you tried to overwrite the same byte(s) that somebody else did, but as it stands, modifying nearby bytes might be enough --- or not, if there's a chunk boundary between. On the whole, though, it's not clear to me why concurrent updates of sections of large objects is a good application design. You probably ought to rethink how you're storing your data. regards, tom lane