Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
we should not commit every time . why?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Interview Questions
Author Message
uma rao
Currently Banned

New User


Joined: 20 Oct 2007
Posts: 9
Location: delhi

PostPosted: Mon Oct 22, 2007 12:02 pm    Post subject: we should not commit every time . why?
Reply with quote

can anybody clarify this?
Back to top
View user's profile Send private message
References
PostPosted: Mon Oct 22, 2007 12:02 pm    Post subject: Re: we should not commit every time . why? Reply with quote

Moved: Mon Oct 22, 2007 12:31 pm by mcmillan From CICS to Interview Questions
vasanthkumarhb

Senior Member


Joined: 06 Sep 2007
Posts: 300
Location: Bang,iflex

PostPosted: Mon Oct 22, 2007 12:59 pm    Post subject:
Reply with quote

Hi Uma,

In DB2 there are isolation levels such as RS(Read stability) CS(cursor stability) RR(Repeable Read) UR(un commited read).

In these isolation levels there will be different levels of locks, for example: if you are using Isolation level of cursor stability in your application for retrieving rows or updating the rows, then lock will be retained on the last row retrieved during reading the rows and the row lock will be acquired only on the row which is being updated.

So if any other application accessing the same table and doing updation on any other row and at the same time you are attempting to commit the work then changes maded by your aplication and by other application also saved, if you want to avoid this u can go for other isolatioin level and commit the operatiion.


Regard's
Vasanth....... icon_smile.gif
Back to top
View user's profile Send private message
uma rao
Currently Banned

New User


Joined: 20 Oct 2007
Posts: 9
Location: delhi

PostPosted: Mon Oct 22, 2007 1:07 pm    Post subject: Reply to: we should not commit every time . why?
Reply with quote

hi vasanth! thanks for ur response. but i think it is not accurate answer to my question. and i had askd about that why don't we use commit everytime?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 2325
Location: italy

PostPosted: Mon Oct 22, 2007 1:09 pm    Post subject: Reply to: we should not commit every time . why?
Reply with quote

Can You clarify, please, what You/the_interviewer means by "every time"
Back to top
View user's profile Send private message
vasanthkumarhb

Senior Member


Joined: 06 Sep 2007
Posts: 300
Location: Bang,iflex

PostPosted: Mon Oct 22, 2007 1:12 pm    Post subject:
Reply with quote

Hi,

Please specify your queestion in post rather more in subject line....


clarify your question once again.


Regard's

Vasanth....... icon_smile.gif
Back to top
View user's profile Send private message
uma rao
Currently Banned

New User


Joined: 20 Oct 2007
Posts: 9
Location: delhi

PostPosted: Mon Oct 22, 2007 2:13 pm    Post subject: Reply to: we should not commit every time . why?
Reply with quote

we should not commit every time why ? and what we have to do?

for example you opened cursor and do some operations, and then you have one statement like if sqlcode=00 then commit else roll back.Then you will do further operations.

in these type of situations what you will do?
Back to top
View user's profile Send private message
inamadugu
Warnings : 1

New User


Joined: 23 Aug 2007
Posts: 20
Location: Delhi

PostPosted: Mon Oct 22, 2007 2:42 pm    Post subject: Reply to: we should not commit every time . why?
Reply with quote

I think the question would be " why shouldn't we use COMMIT more often?".

Is it, Uma?
Back to top
View user's profile Send private message
dick scherrer

Global Moderator


Joined: 23 Nov 2006
Posts: 6756
Location: 221 B Baker St

PostPosted: Mon Oct 22, 2007 8:17 pm    Post subject:
Reply with quote

Hello,

Typically a commit is issued at the end of a Logical Unit of Work (LUW).

The application process defines what a LUW is.

Commits at the end of an LUW are to provide a stable point from which a restart might be done.

Quote:
I think the question would be " why shouldn't we use COMMIT more often?".
More often than what?

Quote:
for example you opened cursor and do some operations, and then you have one statement like if sqlcode=00 then commit else roll back.Then you will do further operations.
in these type of situations what you will do?
Please elaborate on what you want to learn. In your example, the code "keeps" the update(s) when the sql was successful and "backs them out" when the sql is not successful. Usually commit/rollback this is not coded after every sql statement.
Back to top
View user's profile Send private message
uma rao
Currently Banned

New User


Joined: 20 Oct 2007
Posts: 9
Location: delhi

PostPosted: Tue Oct 23, 2007 9:43 am    Post subject: Reply to: we should not commit every time . why?
Reply with quote

Thank you d.sch. May be your way of explanation helps me to elaborate my view!
Back to top
View user's profile Send private message
muthuvel

Active User


Joined: 29 Nov 2005
Posts: 178
Location: Chennai

PostPosted: Tue Oct 23, 2007 11:05 am    Post subject: Reply to: we should not commit every time . why?
Reply with quote

Uma,
This is what my DBA had as the answer
Quote:
This is because.....

Whenever a commit is done the data in the bufferpool is written to the disk.........

If frequent commits are made then it will be additional overhead to the system...........

bufferpool is like RAM in our PC......
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 2325
Location: italy

PostPosted: Tue Oct 23, 2007 2:46 pm    Post subject: Reply to: we should not commit every time . why?
Reply with quote

Quote:
Whenever a commit is done the data in the bufferpool is written to the disk.........


I would say that Your DBA got things wrong..
Data Buffer flushing depends only on buffer management not on commits

DB2 will write log buffers, but, that' s all

DB2 is smart enough to apply changes ,
restarting after a failure, for committed data only..
and discard in flight updates
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Interview Questions All times are GMT + 6 Hours
Page 1 of 1