Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jyJkZ-0006oN-BD for pgsql-general@arkaria.postgresql.org; Wed, 22 Jul 2020 18:45:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jyJkY-00068c-BO for pgsql-general@arkaria.postgresql.org; Wed, 22 Jul 2020 18:45:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jyJkY-00068V-3U for pgsql-general@lists.postgresql.org; Wed, 22 Jul 2020 18:45:54 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jyJkP-00071D-AG for pgsql-general@postgresql.org; Wed, 22 Jul 2020 18:45:53 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1jyJXp-0002mU-NM; Wed, 22 Jul 2020 14:32:45 -0400 Date: Wed, 22 Jul 2020 14:32:45 -0400 From: Bruce Momjian To: Francisco Olarte Cc: Rama Krishnan , Postgres General Subject: Re: Doubt in mvcc Message-ID: <20200722183245.GC3899@momjian.us> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, Jul 13, 2020 at 10:41:28AM +0200, Francisco Olarte wrote: > Rama: > > On Mon, Jul 13, 2020 at 9:52 AM Rama Krishnan wrote: > > I m preparing for interview one of the recruiter asked me mvcc drawbacks as i told due to mvcc it use more space and need to perform maintenance activity. > > Another one is the same data causes an update conflict because two different transactions can update the same version of the row. > > he told its wrong, kindly tell me will you please tell me its correct or wrong? > > I'm not sure I understand your question too well, you may want to > refresh/expand. > > One interpretation is, on a pure MVCC contest, two transactions, say 5 > and 6, could try to update a tuple valid for [1,) and end up > generating two new tuples, [5,), [6,) and closing the original at > either [1,5) or [1,6) . > > That's why MVCC is just a piece, locking is other. On a MVCC the > tuples are locked while a transaction manipulates them. Other > transactions may read them, which is why readers do not block writers, > but two updates on the same tuple serialize. You might want to look at this: https://momjian.us/main/presentations/internals.html#mvcc -- Bruce Momjian https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee