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.

Chapter 4: Transactions<br />

• commit_sequence_num – indicates the order that the transaction was committed;<br />

will be NULL if the transaction is still active<br />

• is_snapshot<br />

• 1 if this is a SNAPSHOT isolation level transaction<br />

• 0 if it is in here for a different reason, such as a READ_COMMITTED_SNAPSHOT<br />

transaction.<br />

• first_snapshot_sequence_num – the lowest active transaction_sequence_<br />

num value of any of the transactions that were active when the current SNAPSHOT<br />

transaction was started (any subsequent XSNs would need to be preserved for this<br />

transaction's use; column displays 0 for non-SNAPSHOT transactions<br />

• elapsed_time_seconds – elapsed time since this transaction acquired XSN.<br />

sys.dm_tran_current_snapshot<br />

This single-column DMV returns the transaction_sequence_num of all the<br />

active transactions in the version store relevant to the current transaction at the time<br />

the current SNAPSHOT transaction started. No results are returned if the current<br />

transaction is not a SNAPSHOT transaction.<br />

In and of itself, this DMV does not provide much information for the DBA. I find it pertinent<br />

only for running an IF EXISTS query to determine if there is valid row versioning<br />

occurring when I am about to execute a query against a snapshot-enabled database.<br />

sys.dm_tran_transactions_snapshot<br />

The final non-aggregate DMV pertaining to snapshot isolation is sys.dm_tran_<br />

transactions_snapshot. The results are a superset of those that are returned for<br />

sys.dm_tran_current_snapshot. It returns the active snapshots for all sessions, not<br />

154

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

Saved successfully!

Ooh no, something went wrong!