Hi Friends,

This is my 22nd blog on SQL Server Trace Flag 2340 in the series of One Trace Flag a Day. You can go to all blogs under that series by clicking here.

There may be a situation when you may face High CPU consumption for some queries after upgrading from SQL Server 2000 to SQL Server 2005 or SQL Server 2008. The reason of this behaviour is the change in optimization process.  In SQL Server 2005 or SQL Server 2008, query processor can add a sort operation in plan which may not be good for small number of rows. You can check this change by comparing the query plans for both SQL Servers. You will find out an OPTIMIZED keyword in the plan.

We know that sort operations are very useful if we are processing the large number of rows. This feature was added to provide performance benefit if your query plan is going to use a large number of rows.

Microsoft provide a trace flag to overcome this high CPU consumption situation i.e. trace flag 2340.

PS: Do not use trace flags in production environment without testing it on non production environments and without consulting because everything comes at a cost.

HAPPY LEARNING!

Regards:
Prince Kumar Rastogi

Like us on FaceBook | Join the fastest growing SQL Server group on FaceBook

Follow Prince Rastogi on Twitter | Follow Prince Rastogi on FaceBook