Should I commit or rollback a read transaction?

You commit. Period. There’s no other sensible alternative. If you started a transaction, you should close it. Committing releases any locks you may have had, and is equally sensible with ReadUncommitted or Serializable isolation levels. Relying on implicit rollback – while perhaps technically equivalent – is just poor form.

If that hasn’t convinced you, just imagine the next guy who inserts an update statement in the middle of your code, and has to track down the implicit rollback that occurs and removes his data.

Leave a Comment