WinInfo Daily News   |   Windows IT Pro
in
Microsoft Technet

IT Pro Tips


Plan Freezing with SQL Server 2008

By Ronald Barrett

With the advent of SQL Server 2008, many DBAs worry about issues that sometimes arise with updating query plans during the upgrade process. Plan Freezing allows you to store plan guides, which can be reverted to if queries either fail or drain resources after the upgrade. Plan Freezing allows stability to queries and comes with several monitoring features to check if the query succeeded or failed.

In the TechNet Virtual Lab: Plan Freezing with SQL Server 2008 we will see how to prevent query plan regression after a server upgrade, use plan freezing to optimize query performance, and copy query plans between servers. Before proceeding with the lab, Microsoft suggests that you be familiar with the SQL Server Management Studio (SSMS) and with Transact- SQL (T-SQL) Programming.

This virtual lab will teach us to:

    Prevent Query Plan Regression
    Optimize Query Performance
    Copy Query Plans between Servers
TIP: Within the console, there are text instructions for each exercise.  These contain copy commands for the T-SQL programming to simplify the tasks.  Just copy and choose "paste text from host's clipboard" from the action menu in the console. 

 

Exercise 1

In the first exercise, we will generate a plan script onto a test server, deploy the script to a production server, verify the query plan on the production server, and finally, generate a database clone.

We can see how plans are disabled…

And then enabled again for the CustomerSales Script…

Exercise 2

In the second exercise, we run mission critical queries and create plan guides for them, inspect the execution plan of the guide, remove records and confirm that the same execution plan is being used, and then we will disable the plan.

You can see the results of the execution plan in Exercise 2:

In addition, you will compare the three results to see what has changed in each scenario.

Exercise 3

In our final exercise, we generate a plan script on a test server, deploy it to a production server, verify the query plan is on the production server, and finally, generate a database clone.

We see in Exercise 3 how to copy plans from a test server to a production server.

Finally, we clone the database, and the lab ends with us seeing the successful results of our work.

Plan Freezing with SQL Server 2008 is a great Virtual Lab to see how to optimize query plans, move them from test server to production servers, and finally clone the plans amidst several SQL Servers if needed. I hate to admit it because most times I have to deal with T-SQL it is never much fun, but I enjoyed this lab a lot and would recommend that it is worth the time to get an overview of Plan Freezing whether it is your primary role to handle this job function or not.

Comments

No Comments
SPONSORED LINKS FEATURED LINKS

Order Your SQL Fundamentals CD Today! Learn how to use SQL Server, understand Office integration techniques and dive into the essentials of SQL Express and Visual Basic with this free SQL Fundamentals CD. List Your Products in Our Technology Resource Directory Don't miss the chance to post your free listing in this comprehensive directory for IT and developer professionals, powered by Windows IT Pro. But hurry! Deadline ends Oct. 9. Microsoft Exchange & Windows Connections event returns to Las Vegas Nov 10 - 13Connections returns to Las Vegas for this exciting event where each attendee will receive SQL Server 2008 standard with 1 CAL. Co-located with Microsoft ASP.NET, SQL Server, and SharePoint Connections with over 250 in-depth sessions. Free Online Event! Virtualization:Get the Facts!Register now and attend this free, live in-depth online conference on November 13 and 20, 2008, produced by Windows IT Pro. All registrants are eligible to receive a complimentary one-year digital subscription to Windows IT Pro (a $49.95 value)! Check Out Hyper-V Video on ITTVWatch Karen Forster's interview on Hyper-V's performance on ITTV.net. Ease Your Scripting Pains with the Flexibility of PowerShell!Join MVP Paul Robichaux on December 11, 2008 at 11:00 AM EDT as he equips you with PowerShell basics in 3 introductory lessons, each followed by a live Q&A session—all on your own computer! PASS Community Summit 2008 in Seattle on Nov 18-21The don’t-miss event for Microsoft SQL Server Professionals. Register now and you’ll enjoy top-notch Microsoft and Community speakers and more.
Windows IT Pro |  Subscribe |  Register |  Windows FAQ |  Media Kit |  WinInfo News |  Europe Edition |  About Us |  Contact Us/Customer Service |  Affiliates/Licensing
SQL Server Magazine |  Office & SharePoint Pro |  Windows Dev Pro |  IT Library |  Technical Resources Directory |  Windows Excavator |  ITTV |  IT Job Hound

Copyright © 2008 Penton Media, Inc., All rights reserved.  Terms and Use | Privacy Statement | Reprints and Licensing