Re: Doubt in mvcc

From: Ravi Krishna <rkrishna(at)vivaldi(dot)net>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Doubt in mvcc
Date: 2020-07-13 09:51:19
Message-ID: 81860c68-0d85-facd-01a9-8db1a72f933a@vivaldi.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 7/13/2020 4:52 AM, Rama Krishnan wrote:

> For example, two transactions are going to increase the amount on the
> same account by $100 . The first transaction reads the current value
> ($1000) and then the second transaction reads the same value. The first
> transaction increases the amount (this gives $1100) and writes this
> value. The second transaction acts the same way: it gets the same $1100
> and writes this value. As a result, the customer lost $100.
>
>
> Will u please provide more details
>
>
> Serialize is the solution to this issue.

MVCC applies to read and write situation. Readers do not block writers
and writers do not block read. The example you mentioned above is writer
vs writer and MVCC (both Oracle and PG) is not applicable.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2020-07-13 09:52:52 Logical replication from 11.x to 12.x and "unique key violations"
Previous Message Bojan Petrovic 2020-07-13 09:21:08 Interaction between ON CONFLICT index inference and prepared statement generic plans