Main Difference between them
Repeatable Read: Changes are visible only, when all the
Transaction commit. i.e
example if Connection 1 starts a transaction, lets
Begin;
insert query to insert value;
select query to visible the records;
Remember, the above transaction is not committed using commit stmt.
But the newly inserted value can be viewed even without using
commit within the transaction.
Lets Connection 2 do the same thing
Begin;
insert query to insert value;
select query to visible the records;
No commit stmt used
Now Go to connection 1
Use commit stmt and view the records using select query.
This is the most important part, Connection 1 used committed stmt
and can view the newly inserted records which is used in Connection 1,
but still it cannot view newly inserted records done through connection 2.
Even connection 2 cannot view the newly inserted records done
through connection 1 until commit stmt is used. So to visible the
changes both Connection 1 and Connection 2 has to be committed.
Simply, Connection 1 cannot view the changes of Connection 2 until
Connection 2 commits and Connection 2 cannot view the changes made by
Connection 1 until Connection 1 commits
Read Committed: Changes are visible when anyone of the Transaction
commit them
If both Connection 1 and Connection 2 starts a transaction, changes
are visible when anyone of the Connection commit them.
For more information refer
No comments:
Post a Comment