30.06.2013 Views

Performance Tuning with SQL Server Dynamic Management Views

Performance Tuning with SQL Server Dynamic Management Views

Performance Tuning with SQL Server Dynamic Management Views

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

149<br />

Chapter 4: Transactions<br />

Any DML queries will continue to block other DML queries as is necessary to maintain<br />

data integrity.<br />

SNAPSHOT and READ_COMMITTED_SNAPSHOT<br />

modes<br />

Snapshot isolation introduces two new modes of operation:<br />

• SNAPSHOT mode isolates read transactions from modifications that committed after<br />

the transaction began<br />

• READ_COMMITTED_SNAPSHOT mode isolates read transactions from modifications<br />

which committed after the current statement began.<br />

SNAPSHOT mode is initiated at the database level using Listing 4.15.<br />

ALTER DATABASE Test SET ALLOW_SNAPSHOT_ISOLATION ON;<br />

Listing 4.15: Enabling snapshot isolation at the database level.<br />

Note that this command only instructs the database to begin using a version store <strong>with</strong>in<br />

tempdb. It does not affect the behavior of any sessions running against the database.<br />

Any session using the default READ COMMITTED level will continue to operate as normal,<br />

unless to use the version store and take advantage of snapshot isolation, by issuing the<br />

command in Listing 4.16, from <strong>with</strong>in the session.<br />

SET TRANSACTION ISOLATION LEVEL SNAPSHOT;<br />

Listing 4.16: Enabling SNAPSHOT isolation mode for a given session.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!