Re: A simple question about Read committed isolation level

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: weiping he <laser(at)qmail(dot)zhengmai(dot)net(dot)cn>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: A simple question about Read committed isolation level
Date: 2004-04-01 15:55:24
Message-ID: 29626.1080834924@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

weiping he <laser(at)qmail(dot)zhengmai(dot)net(dot)cn> writes:
> txn1: txn2:
> begin; begin;
> update table_a set col= col + 1; update table_a set col = col + 1;
> end; end;

> if two transaction begin at exact the same time,
> what's the result of 'col' after both transactions committed
> in Read committed level? it's 3 or 2?
> My understanding is the result is 3,

If the second xact to lock the row is READ COMMITTED, you get 3.
If it's SERIALIZABLE you get an error. In no case will you silently
lose an update.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Randall Skelton 2004-04-01 15:56:03 Select Union
Previous Message Jim C. Nasby 2004-04-01 15:55:02 Re: row-level security model