Re: Stupid question on Read Committed Isolation Level

Поиск
Список
Период
Сортировка
От Jeroen T. Vermeulen
Тема Re: Stupid question on Read Committed Isolation Level
Дата
Msg-id 20040129175421.GD43961@xs4all.nl
обсуждение исходный текст
Ответ на Stupid question on Read Committed Isolation Level  ("Marc G. Fournier" <scrappy@hub.org>)
Ответы 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>)
Список 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 по дате отправления:

Предыдущее
От: "Marc G. Fournier"
Дата:
Сообщение: Stupid question on Read Committed Isolation Level
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: msg translation into sk_SK, Docs: SGML -> XML