views:

106

answers:

1

I'm a bit confused by the documentation here. I have a transaction, which

  1. start transaction
  2. does some updates
  3. does some selects
  4. does some more updates
  5. commit

I want my selects at step 3 to see the results of updates in step 2 but I want to be able to roll back the whole thing.

read committed seems to imply that selects only show data that's been committed, and repeatable read seems to imply that all subsequent selects will see the same data as existed at the time of the 1st select - thus ignoring my updates. read uncommitted seems to do the right thing, but: "but a possible earlier version of a row might be used" -- this is also not acceptable, as my selects MUST see the result of my updates.

is serializable really my only hope here?

I'm working off the documentation here

A: 

Transaction isolation levels describe only the interaction between concurrent transactions. With any isolation level, stuff that you have updated within the same transaction will be updated when you re-select them from that transaction.

The right isolation level in your case seems to be read commited, so you can rollback at any point and uncommited data is not visible in other transactions.

Henning