ReadCommitted

  • Thread starter Thread starter Ryan Liu
  • Start date Start date
R

Ryan Liu

Hi,

For IsolationLevel.ReadCommitted, here "Committed" does not mean
trans.Commit(), it just means db has been updated. -- Is this right?

It means other thread/connection can read "my" data before I finish a
transaction.

Please clarify this.

Thanks a million1
R L
 
No; "committed" means "committed":

<quote>READ COMMITTED
Specifies that statements cannot read data that has been modified but
not committed by other transactions. This prevents dirty reads. Data
can be changed by other transactions between individual statements
within the current transaction, resulting in nonrepeatable reads or
phantom data. This option is the SQL Server default.

The behavior of READ COMMITTED depends on the setting of the
READ_COMMITTED_SNAPSHOT database option:

If READ_COMMITTED_SNAPSHOT is set to OFF (the default), the Database
Engine uses shared locks to prevent other transactions from modifying
rows while the current transaction is running a read operation. The
shared locks also block the statement from reading rows modified by
other transactions until the other transaction is completed. The
shared locks are released when the statement completes.

If READ_COMMITTED_SNAPSHOT is set to ON, the Database Engine uses row
versioning to present each statement with a transactionally consistent
snapshot of the data as it existed at the start of the statement.
Locks are not used to protect the data from updates by other
transactions.

When the READ_COMMITTED_SNAPSHOT database option is ON, you can use
the READCOMMITTEDLOCK table hint to request shared locking instead of
row versioning for individual statements in transactions running at
the READ_COMMITTED isolation level.</quote>

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top