0

I have a procedure that will be concurrently processed with the following operations:

Procedure:

W(A)
W(B)
R(C)
C + 1;
W(C)

I was tasked to choose between READ COMMITTED or SERIALIZABLE isolation level.

How do I explain that this procedure will not corrupt the database with the above chosen isolation level?

  • 1
    It's hard to say. You've provided very little information to go on. What do the W and R procedures do? What is meant by "corrupt the database"? It would help us to help you if you could provide a more detailed test case. – Boneist Nov 14 '19 at 11:50
  • @Boneist So "corrupt the database" means that the database will be in an inconsistent state. `Insert into Table A Update Table B Select Table C Insert into Table C` Does this help? – Jason Sivan Nov 14 '19 at 12:51
  • By inconsistent state you mean what, exactly? Typically, concurrent transactions worry about race-conditions, which is when two sessions try to update the same row(s). One session will wait until the other session is done before it attempts to do the update, but it's now working off of old data (since, in Oracle, SQL statements are read consistent, meaning you see the data as it was at the start of the query). You can overcome this by using pessimistic or optimistic locking in your code. – Boneist Nov 14 '19 at 13:59

0 Answers0