If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How to increase the performance for transaction ??

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-11-09, 15:05
kanhaiya kanhaiya is offline
Registered User
 
Join Date: Jan 2009
Posts: 2
Question How to increase the performance for transaction ??

Hi all, I have one typical problem of handling transaction. The scenario is my application will create a user profile, so at the end i am inserting/updating 6 tables in sequence. the whole insert /update to 6 tables are one transaction. I am keeping my table locked unless rest of the 5 inserts are done. company standard is page label lock , now we do not want to lock the first table as other application using the first table are timing out,.

1. We want to commit the first table and release the lock. How to handle the error situation and how to roll back if there is any error in rest of inserts


now please suggest me different options that i can implement for transaction management.

1. Bi-temporaral logic is not possible as its not the standard in the company
2. Cant go for row level locking, not the standard of the company
Reply With Quote
  #2 (permalink)  
Old 01-12-09, 03:42
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Change the "standard of the company" to something that makes sense.

Maybe you can use something like DB2_SKIP_INSERTED and related registry settings? Maybe you can use "uncommitted read"? What is "bi-temporaral logic", btw? What would be helpful is to know which DB2 version you are using on which platform.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #3 (permalink)  
Old 01-12-09, 15:06
kanhaiya kanhaiya is offline
Registered User
 
Join Date: Jan 2009
Posts: 2
Db2 V8 on MVS /Zos platform

we are using DB2 v8 on mainframe platform,
1. We can always change the standard of the company if we can justify the change on a system level. The standard is implemented for 7 countries and we need strong facts to support our changes.

2. Bi -temporaral logic is used to preserve data, We do not update any record directly. We do new insert marking the existing one as invalid. There would be one indicator in each table to indicate "INVALID_IND" . On a daily/weekly/monthly basis we will delete all the records with INVALID_IND = 'Y'. So any time if there is any error during the subsequent insert we can revert back to original records.

I am looking for similar mechanism where i can revert back to previous record after commit, if there is any DB2 feature supports the same mechanism
Reply With Quote
  #4 (permalink)  
Old 01-12-09, 17:45
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
I would go to row-level locks because page-level locking also has some nasty and unexpected side effects, especially for simple table spaces. And you should reduce the isolation level as far as possible, i.e. use CS if UR is not acceptable. Aside from that, you can apply the usual performance optimizations (commit early in applications, tune the system, etc.)

Something else you could consider is to store all changes in a staging table (like a global temp table). Once you have all 6 changes, apply them together and without delay to the actual table, then commit.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #5 (permalink)  
Old 01-14-09, 21:06
stephen.song stephen.song is offline
Registered User
 
Join Date: Aug 2004
Posts: 24
why are you keeping your table locked unless rest of the 5 inserts are done ?

I think there`s just a row lock in your table after insert and before commit.
__________________
I am a java and database developer.
Reply With Quote
  #6 (permalink)  
Old 01-15-09, 04:09
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Quote:
Originally Posted by stephen.song
why are you keeping your table locked unless rest of the 5 inserts are done ?

I think there`s just a row lock in your table after insert and before commit.
On INSERTs, DB2 has to keep the X-locks until the end of the transaction to prevent dirty reads. Due to lock hierarchies, you will also have an IX-loxk at the table level. Hierarchical locks are needed for table or system-wide operations, e.g. for a DROP TABLE command, you do not want to X-lock every single row in the table, but just the table itself. But when you do that, you need some information at the table level whether there are locks set on a level further down, i.e. on pages or rows associated with the table.

Whether you have row, page, or table level locks depends on your configuration, isolation level setting and whether lock escalation occurs. So you cannot necessarily assume to have "just a row lock".
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development

Last edited by stolze; 01-15-09 at 04:13.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On