SQL Server 2022 Parameter Sensitive Plan Optimization: How PSP Can Help Some Queries With IF Branches

I’ve spent a bit of time talking about how IF branches can break query performance really badly in SQL Server.

Read the post: SQL Server 2022 Parameter Sensitive Plan Optimization: How PSP Can Help Some Queries With IF Branches

SQL Server IF Branches And Query Performance Part 5: Does Dynamic SQL Work?

If we want to start this post in the right place, we have to go back to 2009. That was the first time a (much) young(er) Erik Darling wrote dynamic SQL…

Read the post: SQL Server IF Branches And Query Performance Part 5: Does Dynamic SQL Work?

SQL Server IF Branches And Query Performance Part 3: Local Variables Still Suck

Parameters get a bad name. It seems everything that gets sniffed does, whether it’s a stored procedure, a piece of anatomy, or an illicit substance.

Read the post: SQL Server IF Branches And Query Performance Part 3: Local Variables Still Suck

Software Vendor Mistakes With SQL Server: IF Branching In Stored Procedures

I still see people calling into this trap when writing stored procedures. What no one seems to realize until it’s too late data grows past a toy data base…

Read the post: Software Vendor Mistakes With SQL Server: IF Branching In Stored Procedures

Starting SQL: Why Not Make Every SQL Server Query Dynamic SQL?

I think it was Doug Lane who coined the stages of dynamic SQL. One of them dealt with the fact that once you start using it, you just wanna use it…

Read the post: Starting SQL: Why Not Make Every SQL Server Query Dynamic SQL?