From: | Mike Mascari <mascarm(at)mascari(dot)com> |
---|---|
To: | "'Jose Manuel Lorenzo Lopez'" <jose-manuel(dot)lorenzo-lopez(at)conti(dot)de>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | RE: About multiple access to a table |
Date: | 2001-06-01 11:31:30 |
Message-ID: | 01C0EA6C.E0468760.mascarm@mascari.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Two simultaneous UPDATEs on the same row will cause the second
transaction to block until the first transaction either commits or
aborts when the TRANSACTION ISOLATION LEVEL is READ COMMITTED. The
second transaction will then perform the update. Two simultaneous
UPDATEs on the same row will cause the second transaction to block
until the first transaction either commits or aborts when the
TRANSACTION ISOLATION LEVEL is SERIALIZABLE as well, *except* that if
the first transaction COMMITs, the second transaction will ABORT; if
the first transaction ABORTs (ROLLBACK), the second transaction will
COMMIT.
You can achieve similar automatic locking of rows for SELECTs by
using SELECT ... FOR UPDATE:
See:
http://www.postgresql.org/idocs/index.php?mvcc.html
for details. With regard to INSERTs, the second transaction will not
see the inserted record until the first transaction commits in READ
COMMITTED, but that doesn't stop phantom and non-repeatable reads. To
prevent the second transaction from seeing INSERTs performed by the
first transaction, regardless of whether or not the first transaction
COMMITs, you must use SERIALIZABLE transaction isolation level. Of
course, you must be using BEGIN/END around these DML statements.
Hope that helps,
Mike Mascari
mascarm(at)mascari(dot)com
-----Original Message-----
From: Jose Manuel Lorenzo Lopez
[SMTP:jose-manuel(dot)lorenzo-lopez(at)conti(dot)de]
Sent: Friday, June 01, 2001 7:14 AM
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] About multiple access to a table
Hello community,
I have a doubt about multiple access to a table in my database.
When two people are accessing the same table for insert or update,
is the affected row locked or am I supposed to lock this row explicit
in my application???
Any help will by welcome! :)
Best Regards / Un saludo / Mit freundlichen Gru?en / Cordiali saluti
Jose Manuel Lorenzo Lopez
From | Date | Subject | |
---|---|---|---|
Next Message | Holger Klawitter | 2001-06-01 12:01:14 | Re: Re: dumping strategy |
Previous Message | Jose Manuel Lorenzo Lopez | 2001-06-01 11:14:20 | About multiple access to a table |