MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Table lock and performance

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
basky_g
Beginner


Joined: 04 Jul 2004
Posts: 5
Topics: 2

PostPosted: Wed Mar 15, 2006 9:12 am    Post subject: Table lock and performance Reply with quote

Hi,
My application needs to update / insert thousands of rows into table 'A' with forceful commit at the end.

My question is whether the performance of the application will increase by taking an exclusive lock on the table 'A' before starting insertion or it doesn't have any bearing on performance.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Mar 15, 2006 9:20 am    Post subject: Reply with quote

Quote:

My application needs to update / insert thousands of rows into table 'A' with forceful commit at the end.


If your inserting thousands of rows then I would suggest you to use an utility like LOAD resume rather than program

Quote:

My question is whether the performance of the application will increase by taking an exclusive lock on the table 'A' before starting insertion or it doesn't have any bearing on performance.


of course your performance will degrade, as the program will wait until it attains the exclusive lock. Once it attains the lock all other applications which access this table have to wait.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
astro
Beginner


Joined: 05 Oct 2005
Posts: 31
Topics: 7

PostPosted: Wed Mar 15, 2006 9:25 am    Post subject: Reply with quote

Hi Basky,
Attaching an brief text from Sander's - EXAM700 Study guide.
Quote:

suppose you have a table that is to be accessed frequently by read-only transactions and periodically by a single transaction designed to perform basic maintenance. Forcing the DB2 Database Manager to only acquire an Exclusive (X) table-level lock whenever the maintenance transaction executes makes more sense than forcing the DB2 Database Manager to globally acquire Exclusive (X) table-level locks for every transaction that needs to access the table.


Hope this will answer your question.
Back to top
View user's profile Send private message
astro
Beginner


Joined: 05 Oct 2005
Posts: 31
Topics: 7

PostPosted: Wed Mar 15, 2006 9:31 am    Post subject: Reply with quote

Hi Basky,
My answer might seem as if it is contradicting to Kollusu's answer.
But kollusu is also right but from other concurrent programs perspective.
So the answer for your question is
" It will improve the performance of "insert" program but will decrease the performance of other programs which are even just to read from this table "

When there are no programs to fetch data from the table when this "INSERT" program is run, then you can go for this explicit lock mode.

Cheers
Back to top
View user's profile Send private message
Manas Biswal
Intermediate


Joined: 29 Nov 2002
Posts: 382
Topics: 27
Location: Chennai, India

PostPosted: Wed Mar 15, 2006 9:34 am    Post subject: Reply with quote

basky_g,

It is very difficult to say what exactly to do without having more information on the table, what type of applications access it, whats the frequency and load of various kinds of transactions on it..etc.
Taking an exclusive lock somtimes makes sense if thats the only maintenance application accessing it at that time and all the other transactions are read-only or you have got a maintenance batch window.
The best way to find out is to run it both ways on your test subsystem and see for yourself.

Regards,
Manas
_________________
There is no path to peace. Peace is the path.
- Mahatma Gandhi (1869-1948)
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
basky_g
Beginner


Joined: 04 Jul 2004
Posts: 5
Topics: 2

PostPosted: Wed Mar 15, 2006 9:35 am    Post subject: Reply with quote

Hi Thanks for your reply.
Kolusu I can't use load utility as some manipulation need to be done on the data.

Also table 'A' will be accessed only by the application in question. No other application is expected to access this data and that is the main reason i was thinking of taking an exclusive lock.

Sander's - EXAM700 Study guide qoute solves my purpose i guess. And astro thanks for your disclaimer Laughing and hope i have answered.
Back to top
View user's profile Send private message
astro
Beginner


Joined: 05 Oct 2005
Posts: 31
Topics: 7

PostPosted: Wed Mar 15, 2006 10:27 am    Post subject: Reply with quote

Dear Basky,
My reply is not a disclaimer but just an extended & conclusive answer for your unclear question.
Back to top
View user's profile Send private message
basky_g
Beginner


Joined: 04 Jul 2004
Posts: 5
Topics: 2

PostPosted: Wed Mar 15, 2006 10:32 am    Post subject: Reply with quote

Agreed Astro, That indeed made things clear.
Thanks all for responding.
Back to top
View user's profile Send private message
chandrankk
Beginner


Joined: 06 Dec 2005
Posts: 8
Topics: 0

PostPosted: Tue Apr 04, 2006 6:04 am    Post subject: Reply with quote

inserting/updating a huge a number of records has another drawback. When the logs become full DB2 may stop and this will cause a major problem. You can't control the log when you do an insert/update. Update will create 2 entries in the log and insert will create 1 and if there are millions of records being updated or inserted, log becomes full (We have 8 log files in our shop and when all the 8 files became full the first one still didn't finish dumping to tape and hence couldn't cycle through)

Even if you have some manipulation to be done, you can do it via a program and write into a file and then use it for loading the table with the Load utility. We have recently had issues while inserting records and the DBA suggested to to a load with LOG NO option.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group