In this chapter, we reviewed a few T-SQL anti-patterns, such as SELECT * syntax, OR logic, and functions in our predicates, that are relatively easy to find simply by looking at our T-SQL code and how it is written. The scenarios covered in this chapter are some of the most common examples of patterns that prevent our T-SQL queries from scaling well and maintaining the expected level of performance throughout the lifetime of the applications. All are easy to detect, and most have easy workarounds. Therefore, when writing queries, try to avoid these anti-patterns by leveraging some of the techniques we outlined here.
In the next chapter, we will investigate some T-SQL anti-patterns that are a bit more difficult to identify as they require some additional research beyond simply reading the code.