Re: Theoretical Basis for SELECT FOR UPDATE

From: Tony Andrews <andrewst_at_onetel.com>
Date: 3 Oct 2005 05:09:28 -0700
Message-ID: <1128341368.088540.116220_at_o13g2000cwo.googlegroups.com>


vc wrote:
> But any update in the database already locks the rows being updated.
> What is gained by the comma operator ? If you mean that concurrent
> select operations will be blocked during a set of comma delimited
> operators execution, then in fact you convert all database
> transactions from being concurrent to serial. If I misunderstood you,
> please elaborate.

No, the comma operator has nothing to do with other, concurrent transactions really. It has to do with making the transaction atomic *from the perspective of the session performing the operation*. Gene has already given a good example about printing information half-way through the transaction; that might look like this:

update account set bal=bal+10 where ac_no=123; call print_total_balance_for_all_accounts; update account set bal=bal-10 where ac_no=456; commit;

The TTM version would make it impossible to print the intermediate total (which would be 10 higher than it should be). Received on Mon Oct 03 2005 - 14:09:28 CEST

Original text of this message