O'Reilly logo

Microsoft SQL Server 2012 Performance Tuning Cookbook by Bihag Thaker, Ritesh Shah

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using arithmetic operator wisely in predicate to improve performance

Arithmetic operation directly on the column name in the WHERE condition makes your condition non-sargable and index defined on the column will not get performance benefits. As long as possible, try to avoid this situation by logical workarounds to gain performance boosts.

Getting ready

There is no automatic way to find this behavior; this is simply a manual process. You either keep this step in mind while developing the SQL script or while working on performance tuning projects.

Let us use two tables from the AdventureWorks2012 database to demonstrate this exercise.

  • [AdventureWorks2012].[HumanResources].[Employee]
  • [AdventureWorks2012].[HumanResources].[EmployeePayHistory]

How to do ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required