Quote:
|
Originally Posted by jithudb2
Thank you Stealth_DBA for your prompt reply.
In what situation/scenario can we leave it to the database to handle the data integrity issues and are there any situations where the application need to handle data integrity issues for itself or we can just leave it to the database.
|
Not all databases use the same locking methodologies. DB2 uses pessimistic locking, which means it assumes that the programmer is not going to take of data integrity and DB2 will do it for them. In some cases, because of poorly coded applications, this may lead to lock contention (while providing data integrity), but you can work those problems out if and when they occur.
Make sure you have your LOCKTIMEOUT db parm changed from -1 to about 30 (seconds) so you will get a -911 reason code 68 if a program is waiting for more than 30 seconds for a lock to be released. Otherwise the program may wait forever for a lock to be released.
If you are having (or suspect you may have) lock contention problems, then take a look at these registry variables (db2set) to speed things up:
db2set DB2_SKIPDELETED=ON
db2set DB2_SKIPINSERTED=ON
db2set DB2_EVALUNCOMMITTED=ON (this one may require some analysis to make sure it is OK to use for a particular application).