Alexey B.
Alexey B.

Reputation: 1156

Do I need transactions for read-only access in mssql/readcommited environment

Assuming, we are using MSSQL and working on read commited isolation level (so, the associated phenomena are acceptable) do I need a transaction when performing several consecutive select queries? Is there any difference between performng several consecutive select queries in a single transaction and performing them in separate transactions?

Upvotes: 0

Views: 464

Answers (2)

Martin Smith
Martin Smith

Reputation: 453910

No there is no difference whatsoever. Under default read committed isolation level S locks are released as soon as data is read.

It doesn't wait until the end of the statement even let alone the end of the transaction.

Upvotes: 3

TomTom
TomTom

Reputation: 62159

Is there any difference between performng several consecutive select queries in a single transaction and performing them in separate transactions?

Depends on the isolation level of the selecting connnection. Can be a lot (leaving locks on every item read) or not.

Upvotes: 0

Related Questions