Re: Stupid question on Read Committed Isolation Level

From: "Jeroen T(dot) Vermeulen" <jtv(at)xs4all(dot)nl>
To: "Marc G(dot) Fournier" <scrappy(at)hub(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Stupid question on Read Committed Isolation Level
Date: 2004-01-29 17:54:21
Message-ID: 20040129175421.GD43961@xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 29, 2004 at 01:33:48PM -0400, Marc G. Fournier wrote:

> What happens if I abort on the first transaction? If I'm reading this

Doesn't matter, because your second transaction doesn't read any of the
changes you're making there--until (and if) that first one commits. The
second transaction simply doesn't care if the the first has been aborted
or is still running. It would if the transaction level were READ
UNCOMMITTED, but with postgres we don't need to worry about that.

> right, if Trans2 does the exact same as above, and COMMITs before Trans1
> Aborts, the value of balance becomes +200 (Trans2 + Trans1) ... but what
> happens when Trans1 ABORTS? Trans2 believes its COMMIT worked, but
> ABORTng Trans1 will rollback to the original value, no?

Trans2's commit did work, and it never did influence Trans1. And even if
it did, no matter because Trans1 never happened.

In this kind of application of course you would want to use SERIALIZABLE
instead--and that deals with paradoxes by failing the COMMIT.

Jeroen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2004-01-29 18:02:12 Re: msg translation into sk_SK, Docs: SGML -> XML
Previous Message Marc G. Fournier 2004-01-29 17:33:48 Stupid question on Read Committed Isolation Level