Commit vs Rollback

Richard David  wrote:
> I'm sorry if this seems like a troll, but I really would like to settle
> an Ingres argument :-
> 
> Programmer 'A' likes to release locks after issuing a simple SELECT
> query using ROLLBACK. Programmer 'B' prefers to use COMMIT.
> 
> Which is better ROLLBACK, COMMIT or is there any difference?
> 
> The reason behind this is that programmer 'B' says that OpenIngres /
> Ingres II is more efficient using COMMIT. Programmer 'A' disagrees...
> 
> Can I please have your valued opinions and more importantly why?
> 
> Sorry!

Richard,

There is a slight difference in some cases.  If the session was only
selecting data then there should not be any logging activity (other
than when the session was initiated).  In this case COMMIT and 
ROLLBACK behave exactly the same (i.e., nothing was written
to the log buffers and therefore the log buffers are not flushed).

When there is logging activity then there are slight differences
between Ingres 6.4 and OpenIngres 1.2/2.0/Ingres II.  In either
case the ROLLBACK will perform log reads while the COMMIT
does not perform log reads.  This is physical I/O (albeit to RAM)
and therefore has overhead.  The difference between logging
activity in Ingres 6.4 between commit and rollback is almost
non-existent (commit fares a little better).  In OpenIngres / 
Ingres II there is a much larger difference (the commit is much
more efficient, performing fewer log writes and log write I/O's).

So basically from a pure performance perspective the COMMIT
is a little better.  The difference would probably not be noticed
in most environments.  This can easily be validated in a quiet
installation (since log buffers are shared) with two sessions
(one in ISQL and one in IPM).

Chip Nickolett              ChipN@Comp-Soln.com
Comprehensive Consulting Solutions, Inc.  (www.Comp-Soln.com)
Phone:  414-544-9954  Fax: 414-544-1236
Ingres Q & A
Back to William's Home Page

© William Yuan 2000

Email William