Chapter 7. Common Language Runtime DMVs

 

This chapter covers

  • Overview of SQL CLR processing
  • Identifying queries that spend the most time in the CLR
  • Getting information about your SQL CLR assemblies

SQL is great for performing set-based processing, where one or more rows of data are manipulated in accordance with set theory. In the early days, Structured Query Language (SQL) was extended, typically by third parties looking for commercial advantage, to benefit from an increasingly technical environment. These nonstandard, third-party-based SQL extensions were often embedded into a host programming language to enhance its programmability. Extending the reach of SQL has a long history, culminating in the current movement of using the Common Language Runtime (CLR) to extend SQL programmability.

Although this book is primarily about DMVs, I want to stray a little from the CLR-based DMVs initially. I feel that in order for you to understand the CLR-based DMVs, coupled with the fact that many SQL practitioners may not be so familiar with CLR code, it would be best to first provide a background to CLR processing. In addition, in this chapter I’ll create a small SQL CLR class, which will provide regular expression functionality, allowing complex pattern matching to be used within SQL queries. I hope this will offer a gentle introduction to the subject as well as provide a useful piece of functionality.

7.1. Introducing the CLR

7.2. A simple CLR example

7.3. .NET Framework performance concerns

7.4. Time-consuming CLR queries

7.5. Queries spending the most time in the CLR (snapshot version)

7.6. Relationships between CLR DMVs and other DMVs

7.7. Getting information about SQL Server CLR integration

7.8. Getting information about your SQL CLR assemblies

7.9. Summary