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 1ijEoi-0001Ar-7j for pgsql-general@arkaria.postgresql.org; Mon, 23 Dec 2019 03:55:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ijEog-0005om-KJ for pgsql-general@arkaria.postgresql.org; Mon, 23 Dec 2019 03:55:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ijEog-0005of-2u for pgsql-general@lists.postgresql.org; Mon, 23 Dec 2019 03:55:34 +0000 Received: from mail.saralweb.com ([52.220.40.215] helo=mail.saralweb.org) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ijEoY-0005CE-Pj for pgsql-general@postgresql.org; Mon, 23 Dec 2019 03:55:32 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.saralweb.org (Postfix) with ESMTP id C1375C41DCBE; Mon, 23 Dec 2019 09:25:24 +0530 (IST) X-Virus-Scanned: amavisd-new at saralweb.com Received: from mail.saralweb.org ([127.0.0.1]) by localhost (server23.netgables.com [127.0.0.1]) (amavisd-new, port 12501) with ESMTP id UFAoHL3Imn9L; Mon, 23 Dec 2019 09:25:22 +0530 (IST) Received: from localhost.localdomain (unknown [61.247.239.236]) by mail.saralweb.org (Postfix) with ESMTPSA id F0DFBC420BE2; Mon, 23 Dec 2019 09:25:21 +0530 (IST) Subject: Re: Tuple concurrency issue in large objects To: Justin , Tom Lane Cc: Daniel Verite , Rene Romero Benavides , Postgres General References: <0874ff74-7ffc-4a1d-ba26-1a617bb34c59@email.android.com> <70757632-58a5-4bf1-a4b8-af2ed5a4fa9a@manitou-mail.org> <5126.1576685560@sss.pgh.pa.us> <7594.1576689127@sss.pgh.pa.us> From: Shalini Message-ID: <416c2475-7782-f410-6f67-e99bd36aa688@saralweb.com> Date: Mon, 23 Dec 2019 09:25:19 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------E8585A961D6EAA9E1782FE94" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------E8585A961D6EAA9E1782FE94 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Well.. it seems I have to rethink about my application design. Anyway, thank you all for your insights and suggestions. On 12/18/2019 10:46 PM, Justin wrote: > I agree  completely, > > I do not think Postgresql is a good fit for Shalini based on the > conversation so far > > tracking Concurrency is going to be a killer...  But i see the > temptation to use a DB for this as the updates are ACID less likely to > corrupted data for X reason > > On Wed, Dec 18, 2019 at 12:12 PM Tom Lane > wrote: > > 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 > --------------E8585A961D6EAA9E1782FE94 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Well.. it seems I have to rethink about my application design. Anyway, thank you all for your insights and suggestions.

On 12/18/2019 10:46 PM, Justin wrote:
I agree  completely, 

I do not think Postgresql is a good fit for Shalini based on the conversation so far

tracking Concurrency is going to be a killer...  But i see the temptation to use a DB for this as the updates are ACID less likely to corrupted data for X reason 

On Wed, Dec 18, 2019 at 12:12 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Justin <zzzzz.graf@gmail.com> 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

--------------E8585A961D6EAA9E1782FE94--