Home > database >  When the update relative transactional consistency problems will arise?
When the update relative transactional consistency problems will arise?

Time:10-08

Everybody discussion SQL consistency problems are generally such two SQL
 
Upadte table set value=https://bbs.csdn.net/topics/0;

Upadte table set value=https://bbs.csdn.net/topics/100;

This update SQL under the high concurrency problem is almost a certainty, because the value has been written to death, there is no room for everything, once appear, dirty reads, etc., the value is wrong

But such SQL
 
Upadte table set value=https://bbs.csdn.net/topics/value - 100;

Upadte table set value=https://bbs.csdn.net/topics/value + 50;

Oracle in the update insert, delete is said automatic row-level locks
So in that case, I feel this kind of to update relative writing should be no transaction issues

Want to discuss with everybody I the idea isn't the right

Looking forward to you comments

CodePudding user response:

Oracle will not appear dirty read

Update and row-level locking is who say, I'm going to check out the address

CodePudding user response:

1, the problem of the building Lord, I do a little look not to understand, also don't know where do we get the original poster these opinions or views, personal feel inappropriate;
2, write this two kinds of SQL, the original poster will be involved in the transaction;
3, by default, Oracle will not occur dirty degree, Oracle default transaction level to read commttied,

CodePudding user response:

reference 1st floor nayi_224 response:
oracle will not appear dirty read

Update and row-level locking is who say, the address to me to check out


Oracle update will add row locks, this is no problem,

CodePudding user response:

reference lhdz_bj reply: 3/f
Quote: refer to 1st floor nayi_224 response:
oracle will not appear dirty read

Update and row-level locking is who say, the address to me to check out


Oracle update will add row locks, this is no problem,


That is true, but that oracle will appear dirty read is mixed up with other databases, and row-level locking is a feature not lock name, always think from errors made in the basis of this,

CodePudding user response:

refer to the second floor lhdz_bj response:
1, the problem of the building Lord, I do a little look not to understand, also don't know where do we get the original poster these opinions or views, personal feel inappropriate;
2, write this two kinds of SQL, the original poster will be involved in the transaction;
3, by default, Oracle will not occur the dirty degree, Oracle default transaction level to read commttied,

Dirty read the word can describe it is not very accurate, for example, I am using is Java, multithreading perform the SQL said above, the update of the value of the function called query SQL: select a value from the table, it is concluded that value=https://bbs.csdn.net/topics/50, the function to minus 50, calculated the new value=0, this time to update the value has a value of 0, and another thread also got value=50, plus 50 after get the new value=100, and then to update the value=100;
So they have the above two SQL:
 
Upadte table set value=https://bbs.csdn.net/topics/0;

Upadte table set value=https://bbs.csdn.net/topics/100;

But in fact the correct results should be the value or 50, this is the problem that I want to express


If I write SQL like this, is no problem
 
Upadte table set value=https://bbs.csdn.net/topics/value - 50;

Upadte table set value=https://bbs.csdn.net/topics/value + 50;

CodePudding user response:

Nayi_224
reference 4 floor response:
Quote: refer to the third floor lhdz_bj response:
Quote: refer to 1st floor nayi_224 response:
oracle will not appear dirty read

Update and row-level locking is who say, the address to me to check out


Oracle update will add row locks, this is no problem,


That is true, but that oracle will appear dirty read is mixed up with other databases, and row-level locking is features rather than the name of the lock, total feel from errors made in the basis of this,


When I watched the information stated above is called row-level locks, may also he describes problems
Address:
https://www.cnblogs.com/li1111xin/p/4775240.html
  • Related