- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
Microsoft SQL Server 2008 Internals in VB.NET
Microsoft SQL Server 2008 Internals Printing UPC-A Supplement 5 In Visual Basic .NET Using Barcode encoder for VS .NET Control to generate, create UCC - 12 image in Visual Studio .NET applications. www.OnBarcode.comUPC A Recognizer In VB.NET Using Barcode scanner for VS .NET Control to read, scan read, scan image in Visual Studio .NET applications. www.OnBarcode.comYou should see two rows with the same text string and sql_handle, but with different plan_handle values, as shown here. (In our output, the difference between the two plan_handle values is only a single digit so it may be hard to see, but in other cases, the difference may be more obvious.) Encoding Barcode In Visual Basic .NET Using Barcode creator for .NET framework Control to generate, create barcode image in Visual Studio .NET applications. www.OnBarcode.comBarcode Reader In VB.NET Using Barcode reader for VS .NET Control to read, scan read, scan image in .NET framework applications. www.OnBarcode.comtext
UPCA Drawer In Visual C# Using Barcode printer for .NET framework Control to generate, create UPC-A Supplement 2 image in Visual Studio .NET applications. www.OnBarcode.comGenerating UPC Code In .NET Framework Using Barcode encoder for ASP.NET Control to generate, create UPC Symbol image in ASP.NET applications. www.OnBarcode.com-- this is an example of the -- relationship between -- sql_handle and plan_handle SELECT LastName, FirstName, Country FROM Employees WHERE Country <> USA -- this is an example of the -- relationship between -- sql_handle and plan_handle SELECT LastName, FirstName, Country FROM Employees WHERE Country <> USA Draw Universal Product Code Version A In VS .NET Using Barcode drawer for .NET framework Control to generate, create UPC-A Supplement 2 image in VS .NET applications. www.OnBarcode.comPaint 1D Barcode In Visual Basic .NET Using Barcode maker for .NET framework Control to generate, create 1D image in VS .NET applications. www.OnBarcode.comsql_handle
Code128 Maker In Visual Basic .NET Using Barcode maker for .NET Control to generate, create Code 128 image in VS .NET applications. www.OnBarcode.comMatrix 2D Barcode Printer In Visual Basic .NET Using Barcode creator for .NET Control to generate, create Matrix 2D Barcode image in Visual Studio .NET applications. www.OnBarcode.com0x0200000012330 B0EEA82077439354E7A 5B12E1B7E37A1361
QR Code Drawer In VB.NET Using Barcode drawer for .NET framework Control to generate, create QR Code image in VS .NET applications. www.OnBarcode.comCode 93 Extended Creation In VB.NET Using Barcode generator for VS .NET Control to generate, create ANSI/AIM Code 93 image in .NET framework applications. www.OnBarcode.complan_handle
Draw GS1 - 12 In None Using Barcode encoder for Microsoft Word Control to generate, create UPC-A Supplement 5 image in Word applications. www.OnBarcode.comBarcode Maker In Java Using Barcode maker for Android Control to generate, create barcode image in Android applications. www.OnBarcode.com0x0600120012330B0EB82 187050000000000000000 00000000
Code 128A Creation In Objective-C Using Barcode encoder for iPhone Control to generate, create Code 128 Code Set C image in iPhone applications. www.OnBarcode.comQR Code Printer In .NET Using Barcode creator for .NET framework Control to generate, create QR image in .NET applications. www.OnBarcode.com0x0200000012330 B0EEA82077439354E7A 5B12E1B7E37A1361
2D Barcode Maker In C# Using Barcode maker for .NET framework Control to generate, create Matrix Barcode image in Visual Studio .NET applications. www.OnBarcode.comEAN-13 Supplement 5 Creation In None Using Barcode encoder for Microsoft Word Control to generate, create EAN / UCC - 13 image in Office Word applications. www.OnBarcode.com0x0600120012330B0EB82 186050000000000000000 00000000
Print EAN / UCC - 14 In None Using Barcode generator for Word Control to generate, create EAN128 image in Microsoft Word applications. www.OnBarcode.comRead ANSI/AIM Code 39 In C#.NET Using Barcode scanner for .NET Control to read, scan read, scan image in Visual Studio .NET applications. www.OnBarcode.comWe can see that we have two plans corresponding to the same batch text, and this example should make clear the importance of making sure that all the SET options that affect plan caching should be the same when the same queries are executed repeatedly. You should verify whatever changes your programming interface makes to your SET options to make sure you don t end up with different plans unintentionally. Not all interfaces use the same defaults for the SET option values. For example, the OSQL interface uses the ODBC driver, which sets QUOTED_IDENTIFIER to OFF for every connection, whereas Management Studio uses ADO.NET, which sets QUOTED_IDENTIFIER to ON. Executing the same batches from these two different clients results in multiple plans in cache. sys.dm_exec_query_plan
The function sys.dm_exec_query_plan is a table-valued function that takes a plan_handle as a parameter and returns the associated query plan in XML format. If the plan is for an object, the TVF includes the database ID, object ID, procedure number, and encryption state of the object. If the plan is for an adhoc or prepared query, these additional values are NULL. If the plan_handle corresponds to a Compiled Plan Stub, the query plan will also be NULL. I have used this function in some of the preceding examples. sys.dm_exec_text_query_plan
The function sys.dm_exec_text_query_plan is a table-valued function that takes a plan_handle as a parameter and returns the same basic information as sys.dm_exec_query_plan. The differences between the two functions are as follows: sys.dm_exec_text_query_plan can take optional input parameters to specify the start and end offset of statements with a batch. The output of sys.dm_exec_text_query_plan returns the plan as text data, instead of XML data. 9
Plan Caching and Recompilation
The XML output for the query plan returned by sys.dm_exec_query_plan is limited to 128 levels of nested elements. If the plan exceeds that, a NULL is returned. The text output for the query plan returned by sys.dm_exec_text_query_plan is not limited in size. sys.dm_exec_cached_plans
The sys.dm_exec_cached_plans view is the one we use most often for troubleshooting query plan recompilation issues. It s the one I used in the rst section to illustrate the plan reuse behavior of adhoc plans compared to autoparameterized and prepared plans. This view has one row per cached plan, and in addition to the plan_handle and usecounts, which we ve looked at already, this DMV has other useful information about the cached plans, including the following: size_in_byte
The number of bytes consumed by this cache object
cacheobjtype The type of the cache object; that is, if it s a Compiled Plan, or a Parse Tree or an Extended Proc memory_object_address The memory address of the cache object, which can be used to get the memory breakdown of the cache object Although this DMV does not have the SQL Text associated with each compiled plan, we ve seen that we can nd it by passing the plan_handle to the sys.dm_exec_sql_text function. We can use the query below to retrieve the text, usecounts, and size_in_bytes of the compiled plan and cacheobjtype for all the plans in cache. The results are returned in order of frequency, with the batch having the most use showing up rst: SELECT st.text, cp.plan_handle, cp.usecounts, cp.size_in_bytes, cp.cacheobjtype, cp.objtype FROM sys.dm_exec_cached_plans cp CROSS APPLY sys.dm_exec_sql_text(cp.plan_handle) st ORDER BY cp.usecounts DESC;
|
|