Wednesday, October 04, 2017

 

SQL Server: Do You Have a Poorly Performing Query you can't Explain?

If you are running a SQL Server version prior to SQL Server 2016, and you have a query whose plan just doesn't seem right and you can't explain it, try running it with trace flag 4199

SELECT SomeColum
FROM SomeTable
OPTION(QUERYTRACEON 4199)
It enables all the query optimiser hot fixes present in your applied SP and CU version.
Many DBAs enable this trace flag globally (at the instance level).
SQL Server 2016 will automatically enable all prior version query optimiser hot fixes.

SQL Server query optimizer hotfix trace flag 4199 servicing model
SQL Server 2016: The Death of the Trace Flag


    

Powered by Blogger