ROLLBACK vs COMMIT when nothing done

ROLLBACK vs COMMIT when nothing done

Post by Stuart Ke » Wed, 27 Jul 1994 09:36:56



Given the situation where you BEGIN WORK and shortly thereafter you
want to end the transaction *but nothing has been altered*, WRT efficiency
is it better to COMMIT or ROLLBACK?

e.g.

FUNCTION xyz()
        BEGIN WORK
        IF (NOT LockSomeRecord())       -- Failed
                ROLLBACK WORK           -- Better to COMMIT?
                RETURN
        END IF

        ...
        COMMIT WORK
END FUNCTION

where LockSomeRecord declares a cursor for update, and fetch's the row

-SRK

--

James Cook University
Townsville                      Tel: +61 77 814992
Qld 4811 Australia              FAX: +61 77 814029

 
 
 

ROLLBACK vs COMMIT when nothing done

Post by Colonel Pan » Fri, 29 Jul 1994 11:07:59



>Given the situation where you BEGIN WORK and shortly thereafter you
>want to end the transaction *but nothing has been altered*, WRT efficiency
>is it better to COMMIT or ROLLBACK?

If you are sure nothing's been done that you don't want to keep, then COMMIT.  
Commit is the least amount of work.

--

  Disclaimer: Sender under influence of 1,3,7-trimethylxanthine

 
 
 

ROLLBACK vs COMMIT when nothing done

Post by Kerry Sainsbu » Fri, 29 Jul 1994 17:50:25




> Given the situation where you BEGIN WORK and shortly thereafter you
> want to end the transaction *but nothing has been altered*, WRT efficiency
> is it better to COMMIT or ROLLBACK?

> e.g.

> FUNCTION xyz()
>  BEGIN WORK
>  IF (NOT LockSomeRecord()) -- Failed
>   ROLLBACK WORK  -- Better to COMMIT?
>   RETURN
>  END IF

>  ...
>  COMMIT WORK
> END FUNCTION

My understanding is that Informix always assumes the best, so that
COMMIT WORK just releases any locks, while a ROLLBACK WORK needs to
trundle back thru the transaction and "undo" everything.

------------------------------------------------

 R&D Dude, Quanta Systems, Auckland, New Zealand
 ph. +64 9 377-4473 (work). +64 9 276-5546 (home)
-------------------------------------------------

 
 
 

1. Transactions and commit() vs. rollback() and pl/sql

Hi,

If I explicitly commit a transaction in my pl/sql code, will that
transaction stay committed if i rollback from the calling environment,
my jdbc code?  I'm guessing no - that my pl/sql code will take
precedence.  How is anything affected if I call several stored
procedures, some of which commit, others which do not, or if i
call....confused.

What if I don't explicitly commit in pl/sql, but then rollback or
commit in my jdbc code?  I'm guessing my jdbc code takes precedence
here.

Do things change if I'm using an EJB server?

Will try some things out now...

Thanks.

2. Help, Locked out after failed DTS

3. RollBack vs. Commit

4. views called by ?

5. Recordset.Close, set Recordset = Nothing vs set Recordset = Nothing

6. Is anyone in IRELAND????

7. Oracle commits vs Sybase/SQL-Server commits

8. Oracle DBA FAQs

9. SQL Server seems doing nothing while VB applicaiton hangs

10. Scheduled Tasks Just Sit There Doing Nothing

11. DBMS_OUTPUT.put_line seems done nothing ?

12. Commit/rollback inside store procs