Archive for 'TSQL Optimization'

Using TSQL expressions inside functions may significantly reduce SQL Server performance

Brett Hawton – 4 October 2010 In a previous article I had shown how to quantify and rank your “heaviest” queries according to the overall load they placed on your system. That discussion had shown that at most sites it’s often NOT the infrequent long-running queries which are placing the greatest load on SQL Server [...]

Finding the “heaviest” TSQL to Optimize in SQL Server

Brett Hawton – 27 September 2010 There have been many articles written about methods to try to identify the worst performing TSQL statements on a SQL Server in order to optimize those statements for improved execution speed. Typically, the time-honored method is to either run a continuous trace or harvest the DMV information at frequent [...]

Take your indexed columns out of functions to really boost SQL Server performance!

Brett Hawton – 23 September 2010 In a future article I will show how to quantify and rank your “heaviest” SQL Server queries according to the overall load they place on your system. That discussion will show that at most sites it’s often NOT the infrequent long-running queries which are placing the greatest load on [...]

Performance of COALESCE vs. IS NULL

Brett Hawton – 21 September 2010 There are a great many articles out there expounding the virtues of using the ANSI standard COALESCE function over the non-standard IS NULL function. Indeed even the SQL Server MVP’s and SQL Server PSS have weighed in on the issue showing that in most cases the plans produced by [...]

Less than stellar IN performance

Brett Hawton – 17 September 2010 Whilst performing workload analysis at a number of clients I have seen an inordinate percentage of queries using the IN clause in a WHERE statement where a BETWEEN clause would have sufficed. Upon investigation it was found that in areas where application developers allowed users to select a number [...]

Finding non-existent records in a hurry

Brett Hawton – 14 September 2010 A TSQL author writing scripts for Microsoft SQL Server can choose from a number of commonly used techniques for extracting records in one table which do not have corresponding records in a second (lookup) table. The three most utilized methods in practice are: NOT EXISTS NOT IN LEFT JOIN [...]