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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

163<br />

Chapter 4: Transactions<br />

In short, this script is very useful in allowing the DBA to identify transactions that will<br />

rely upon the version store if other transactions, competing for the same resources/rows,<br />

make modifications to those rows. High count of versions in the version store may point<br />

to a row/resource that is in high demand, i.e. a lot of other transactions are also hitting<br />

the same row/resource and the version store needs to spawn frequent versions of it to<br />

maintain concurrency under snapshot isolation. You may find yourself needing to adjust<br />

the size of your tempdb in order to accommodate this situation.<br />

Finally, in order to observe the difference in behavior between the two SNAPSHOT<br />

and READ_COMMITTED_SNAPSHOT queries, return to Tab 1 (Listing 4.19) and Tab 2<br />

(Listing 4.20) and commit the modifications. Go to Tab 3 (Listing 4.21), which is running<br />

in SNAPSHOT mode, highlight only the SELECT query and rerun it. Since the initial<br />

transaction in this session started before the addition of the fourth row was committed,<br />

only the three rows committed before the transaction began are returned.<br />

Now go to Tab 4 (Listing 4.22), which is running in SNAPSHOT_READ_COMMITTED mode,<br />

and rerun the query. Since the INSERT and UPDATE transactions were committed before<br />

the statement was run, all four rows will be returned, as shown in Figure 4.13.<br />

Figure 4.13: Demonstrating the difference in behavior between SNAPSHOT and<br />

READ_COMMITTED_SNAPSHOT.<br />

As a final clean up, commit or roll back all outstanding transactions.

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

Saved successfully!

Ooh no, something went wrong!