Index seeks on date and CONVERT

Using functions on columns typically prevents SQL Server from being able to efficiently use an index with a seek (sargability).  When it comes to DATE and DATETIME data types, there are some exceptions. A common use case I see is where a column contains a DATETIME data type; however, a query needs to look at […]

Read More

What’s filling up tempdb?

If you’ve ever received an alert that tempdb was running out of space, you probably want to know what session/query is consuming tempdb.  There are two ways tempdb gets consumed.  User tempdb usage and system tempdb usage. User temdpb usage is related to creating and populating @table variables or #temporary tables and explicitly populating them. […]

Read More

Plan guides made easy

Plan guides are a useful tool for changing an execution plan when despite your best efforts the optimizer just isn’t coming up with the optimal plan.  This becomes useful for situations where you can’t make code changes to a query or stored procedure.  People are sometimes hesitant to use them due to the complexity in […]

Read More

Tuning Substring Query Without Changing the Query

 Introduction The blog shows how to tune a query using substring in the WHERE clause. The tuning solution is to use indexing on a computed column. Performance Issue A General Ledger financial report execution in Financial system takes a long time finishing more than 4 hours. Performance Analysis The first step in the performance tuning […]

Read More