Stupid question on Read Committed Isolation Level
От | Marc G. Fournier |
---|---|
Тема | Stupid question on Read Committed Isolation Level |
Дата | |
Msg-id | 20040129132813.H6922@ganymede.hub.org обсуждение исходный текст |
Ответы |
Re: Stupid question on Read Committed Isolation Level
Re: Stupid question on Read Committed Isolation Level |
Список | pgsql-hackers |
http://www.postgresql.org/docs/7.3/static/transaction-iso.html#XACT-READ-COMMITTED Reading this: " BEGIN;UPDATE accounts SET balance = balance + 100.00 WHERE acctnum = 12345;UPDATE accounts SET balance = balance - 100.00WHERE acctnum = 7534;COMMIT; If two such transactions concurrently try to change the balance of account 12345, we clearly want the second transaction to start from the updated version of the account's row. Because each query is affecting only a predetermined row, letting it see the updated version of the row does not create any troublesome inconsistency. " What happens if I abort on the first transaction? If I'm reading this 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? Or am I reading that section wrong? :( ---- Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664
В списке pgsql-hackers по дате отправления: