Hello Geeks and welcome to the Day 52 of the long series of One DMV a day. In this series of blogs I will be exploring and explaining the most useful DMVs in SQL Server. As we go ahead in this series we will also talk about the usage, linking between DMVs and some scenarios where these DMVs will be helpful while you are using SQL Server. For the complete list in the series please click here.

Yesterday I have covered sys.dm_tran_current_transaction. Today I will be talking about sys.dm_tran_version_store. This DMV returns a row for each record in the version store. This DMV is inefficient as it returns all the records in the version store. So do not run it unless you know what and why you are running it.

Sys.dm_tran_version_store gives the information related to the version record. Let us run two transactions with snapshot isolation level. We will see the version records generated for them.

First session:

Second session:

Now we will see the output from sys.dm_tran_version_store.

sys.dm_tran_version_store

Based on the record length the version record can be split into two pages. If the length is more than 8192 bytes the second part of record image is not null in the above output. You can also use sys.dm_tran_version_store to get the number of version records or size of version store.

sys.dm_tran_version_store

Tomorrow I will cover another transaction related DMV.  So stay tuned. Till then.

Happy Learning,
Manu

Like us on FaceBook | Join the fastest growing SQL Server group on FaceBook |
Follow me on Twitter | Follow me on FaceBook