High CPU utilization may occur with your queries on SQL Server 2005 and SQL Sever 2008 servers compared to SQL Server 2000

Extended support for SQL Server 2005 ended on April 12, 2016

If you are still running SQL Server 2005, you will no longer receive security updates and technical support. We recommend upgrading to SQL Server 2014 and Azure SQL Database to achieve breakthrough performance, maintain security and compliance, and optimize your data platform infrastructure. Learn more about the options for upgrading from SQL Server 2005 to a supported version here.

This article has been archived. It is offered "as is" and will no longer be updated.

After upgrading from SQL Server 2000 to either SQL Server 2005 or SQL Server 2008, you may notice some queries may consume more CPU in the new environment. Furthermore, you will notice the query plan has OPTIMIZED keyword.  For an example on a query plan that exhibits this behavior refer to the following blog:

In some cases, SQL Server 2005 and SQL Server 2008 query processor may introduce a sort operation for optimization though it is not required. In these cases wherein the particular plan only touches  a smaller number of rows, the setup cost for the sort operation may outweigh its benefits thus resulting in poor performance.

You can use trace flag 2340 to disable this particular optimization.  But before you use this trace flag, we recommend that you test your applications thoroughly to make sure that you indeed get the expected performance benefits when disabling this optimization. This is because the sort optimization can be very beneficial in cases where there is a substantial increase in the number of rows touched by the plan.

For more information about how to enable a trace flag as a startup option, visit the following MSDN Web site:


Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.

Article ID: 2009160 - Last Review: 12/12/2015 05:27:33 - Revision: 2.0

Microsoft SQL Server 2005 Developer Edition, Microsoft SQL Server 2005 Enterprise Edition, Microsoft SQL Server 2005 Enterprise Edition for Itanium-based Systems, Microsoft SQL Server 2005 Enterprise X64 Edition, Microsoft SQL Server 2005 Evaluation Edition, Microsoft SQL Server 2005 Express Edition, Microsoft SQL Server 2005 Express Edition with Advanced Services, Microsoft SQL Server 2005 Standard Edition, Microsoft SQL Server 2008 Developer, Microsoft SQL Server 2008 Enterprise, Microsoft SQL Server 2008 Enterprise Evaluation, Microsoft SQL Server 2008 Express, Microsoft SQL Server 2008 Express with Advanced Services, Microsoft SQL Server 2008 Web, Microsoft SQL Server 2008 Workgroup

  • kbnosurvey kbarchive KB2009160