Re: Stupid question on Read Committed Isolation Level - Mailing list pgsql-hackers

From Jeroen T. Vermeulen
Subject Re: Stupid question on Read Committed Isolation Level
Date
Msg-id 20040129175421.GD43961@xs4all.nl
Whole thread Raw
In response to Stupid question on Read Committed Isolation Level  ("Marc G. Fournier" <scrappy@hub.org>)
Responses Re: Stupid question on Read Committed Isolation Level  ("Jeroen T. Vermeulen" <jtv@xs4all.nl>)
Re: Stupid question on Read Committed Isolation Level  ("Marc G. Fournier" <scrappy@postgresql.org>)
List 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



pgsql-hackers by date:

Previous
From: "Marc G. Fournier"
Date:
Subject: Stupid question on Read Committed Isolation Level
Next
From: Peter Eisentraut
Date:
Subject: Re: msg translation into sk_SK, Docs: SGML -> XML