Randy Letness wrote:
I'm trying to debug a deadlock. There are two transactions: one updates rows from table foo, and one selects the same rows from table foo for reading. Is it possible to get in a deadlock in this situation? I'm using the default READ_COMMITTED transaction level. The transactions look like:

begin tx1                | begin tx2
select from foo       | delete from foo
                             | insert into foo
                             | insert into foo
commit                   | commit


I would have thought that tx1 would hold only one lock at a time since it is using READ_COMMITTED. Hence, I cannot see how tx1 should be part of a deadlock.

Will there only be one transaction of each type at the same time? Two instances of tx2 could possible deadlock if they access the same two rows in different order (e.g, both inserts a row with the same primary key as the one deleted by the other).

--
Øystein

Reply via email to